一般在产品制造过程中,往往要判断一个模型在出模方向上的最小包容盒尺寸,在NX中可以用坯料尺寸命令实现,当然也有相应的代码实现,这或许可以帮助我们实现一些产品的坯料尺寸批量输出,节省人力。代码如下:
import NXOpen
import NXOpen.UF as UF
def main():
theSession = NXOpen.Session.GetSession()
workPart = theSession.Parts.Work
uf_session=UF.UFSession.GetUFSession()
stockSizeBuilder = workPart.ToolingManager.StockSizes.CreateStocksizeBuilder()
cy_obj_tag=uf_session.Modeling.AskFeatBody(50880)
cylinder=NXOpen.TaggedObjectManager.GetTaggedObject(cy_obj_tag)
stockSizeBuilder.SelectBody.Add(cylinder)
cysmatrix = NXOpen.Matrix3x3()
cysmatrix.Xx = 1.0
cysmatrix.Xy = 0.0
cysmatrix.Xz = 0.0
cysmatrix.Yx = 0.0
cysmatrix.Yy = 1.0
cysmatrix.Yz = 0.0
cysmatrix.Zx = 0.0
cysmatrix.Zy = 0.0
cysmatrix.Zz = 1.0
stockSizeBuilder.SetManipulatorOrientation(cysmatrix)
t1,t2,t3