visual studio codes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

1003 lines
66 KiB

' NX 1953
' Journal created by naikss on Mon Mar 21 10:46:50 2022 India Standard Time
'
Imports System
Imports NXOpen
Module NXJournal
Sub Main (ByVal args() As String)
Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work
Dim displayPart As NXOpen.Part = theSession.Parts.Display
' ----------------------------------------------
' Menu: Assemblies->Components->Add Component...
' ----------------------------------------------
Dim markId1 As NXOpen.Session.UndoMarkId = Nothing
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start")
Dim addComponentBuilder1 As NXOpen.Assemblies.AddComponentBuilder = Nothing
addComponentBuilder1 = workPart.AssemblyManager.CreateAddComponentBuilder()
Dim componentPositioner1 As NXOpen.Positioning.ComponentPositioner = Nothing
componentPositioner1 = workPart.ComponentAssembly.Positioner
componentPositioner1.ClearNetwork()
Dim arrangement1 As NXOpen.Assemblies.Arrangement = CType(workPart.ComponentAssembly.Arrangements.FindObject("Arrangement 1"), NXOpen.Assemblies.Arrangement)
componentPositioner1.PrimaryArrangement = arrangement1
componentPositioner1.BeginAssemblyConstraints()
Dim allowInterpartPositioning1 As Boolean = Nothing
allowInterpartPositioning1 = theSession.Preferences.Assemblies.InterpartPositioning
Dim nullNXOpen_Unit As NXOpen.Unit = Nothing
Dim expression1 As NXOpen.Expression = Nothing
expression1 = workPart.Expressions.CreateSystemExpressionWithUnits("1.0", nullNXOpen_Unit)
Dim unit1 As NXOpen.Unit = CType(workPart.UnitCollection.FindObject("MilliMeter"), NXOpen.Unit)
Dim expression2 As NXOpen.Expression = Nothing
expression2 = workPart.Expressions.CreateSystemExpressionWithUnits("1.0", unit1)
Dim expression3 As NXOpen.Expression = Nothing
expression3 = workPart.Expressions.CreateSystemExpressionWithUnits("0.0", unit1)
Dim unit2 As NXOpen.Unit = CType(workPart.UnitCollection.FindObject("Degrees"), NXOpen.Unit)
Dim expression4 As NXOpen.Expression = Nothing
expression4 = workPart.Expressions.CreateSystemExpressionWithUnits("0.0", unit2)
Dim expression5 As NXOpen.Expression = Nothing
expression5 = workPart.Expressions.CreateSystemExpressionWithUnits("1", nullNXOpen_Unit)
Dim expression6 As NXOpen.Expression = Nothing
expression6 = workPart.Expressions.CreateSystemExpressionWithUnits("1.0", unit1)
Dim expression7 As NXOpen.Expression = Nothing
expression7 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
Dim expression8 As NXOpen.Expression = Nothing
expression8 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit2)
Dim network1 As NXOpen.Positioning.Network = Nothing
network1 = componentPositioner1.EstablishNetwork()
Dim componentNetwork1 As NXOpen.Positioning.ComponentNetwork = CType(network1, NXOpen.Positioning.ComponentNetwork)
componentNetwork1.MoveObjectsState = True
Dim nullNXOpen_Assemblies_Component As NXOpen.Assemblies.Component = Nothing
componentNetwork1.DisplayComponent = nullNXOpen_Assemblies_Component
theSession.SetUndoMarkName(markId1, "Add Component Dialog")
componentNetwork1.MoveObjectsState = True
Dim markId2 As NXOpen.Session.UndoMarkId = Nothing
markId2 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Assembly Constraints Update")
Dim nullNXOpen_Assemblies_ProductInterface_InterfaceObject As NXOpen.Assemblies.ProductInterface.InterfaceObject = Nothing
addComponentBuilder1.SetComponentAnchor(nullNXOpen_Assemblies_ProductInterface_InterfaceObject)
addComponentBuilder1.SetInitialLocationType(NXOpen.Assemblies.AddComponentBuilder.LocationType.Snap)
addComponentBuilder1.SetCount(1)
addComponentBuilder1.SetScatterOption(True)
addComponentBuilder1.ReferenceSet = "Unknown"
addComponentBuilder1.Layer = -1
theSession.PdmSession.SetNativeMode(True, False)
Dim basePart1 As NXOpen.BasePart = Nothing
Dim partLoadStatus1 As NXOpen.PartLoadStatus = Nothing
basePart1 = theSession.Parts.OpenBase("D:\tool1.prt", partLoadStatus1)
partLoadStatus1.Dispose()
theSession.PdmSession.SetNativeMode(False, False)
addComponentBuilder1.ReferenceSet = "Use Model"
addComponentBuilder1.Layer = -1
Dim partstouse1(0) As NXOpen.BasePart
Dim part1 As NXOpen.Part = CType(basePart1, NXOpen.Part)
partstouse1(0) = part1
addComponentBuilder1.SetPartsToAdd(partstouse1)
Dim productinterfaceobjects1() As NXOpen.Assemblies.ProductInterface.InterfaceObject
addComponentBuilder1.GetAllProductInterfaceObjects(productinterfaceobjects1)
addComponentBuilder1.ReferenceSet = "Use Model"
addComponentBuilder1.Layer = -1
Dim partstouse2(1) As NXOpen.BasePart
Dim part2 As NXOpen.Part = CType(theSession.Parts.FindObject("@DB/JP181737/00.02"), NXOpen.Part)
partstouse2(0) = part2
partstouse2(1) = part1
addComponentBuilder1.SetPartsToAdd(partstouse2)
Dim productinterfaceobjects2() As NXOpen.Assemblies.ProductInterface.InterfaceObject
addComponentBuilder1.GetAllProductInterfaceObjects(productinterfaceobjects2)
Dim markId3 As NXOpen.Session.UndoMarkId = Nothing
markId3 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Start")
Dim expression9 As NXOpen.Expression = Nothing
expression9 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
Dim expression10 As NXOpen.Expression = Nothing
expression10 = workPart.Expressions.CreateSystemExpressionWithUnits("p9_x=0.00000000000", unit1)
Dim expression11 As NXOpen.Expression = Nothing
expression11 = workPart.Expressions.CreateSystemExpressionWithUnits("p10_y=0.00000000000", unit1)
Dim expression12 As NXOpen.Expression = Nothing
expression12 = workPart.Expressions.CreateSystemExpressionWithUnits("p11_z=0.00000000000", unit1)
Dim expression13 As NXOpen.Expression = Nothing
expression13 = workPart.Expressions.CreateSystemExpressionWithUnits("p12_xdelta=0.00000000000", unit1)
Dim expression14 As NXOpen.Expression = Nothing
expression14 = workPart.Expressions.CreateSystemExpressionWithUnits("p13_ydelta=0.00000000000", unit1)
Dim expression15 As NXOpen.Expression = Nothing
expression15 = workPart.Expressions.CreateSystemExpressionWithUnits("p14_zdelta=0.00000000000", unit1)
Dim expression16 As NXOpen.Expression = Nothing
expression16 = workPart.Expressions.CreateSystemExpressionWithUnits("p15_radius=0.00000000000", unit1)
Dim expression17 As NXOpen.Expression = Nothing
expression17 = workPart.Expressions.CreateSystemExpressionWithUnits("p16_angle=0.00000000000", unit2)
Dim expression18 As NXOpen.Expression = Nothing
expression18 = workPart.Expressions.CreateSystemExpressionWithUnits("p17_zdelta=0.00000000000", unit1)
Dim expression19 As NXOpen.Expression = Nothing
expression19 = workPart.Expressions.CreateSystemExpressionWithUnits("p18_radius=0.00000000000", unit1)
Dim expression20 As NXOpen.Expression = Nothing
expression20 = workPart.Expressions.CreateSystemExpressionWithUnits("p19_angle1=0.00000000000", unit2)
Dim expression21 As NXOpen.Expression = Nothing
expression21 = workPart.Expressions.CreateSystemExpressionWithUnits("p20_angle2=0.00000000000", unit2)
Dim expression22 As NXOpen.Expression = Nothing
expression22 = workPart.Expressions.CreateSystemExpressionWithUnits("p21_distance=0", unit1)
Dim expression23 As NXOpen.Expression = Nothing
expression23 = workPart.Expressions.CreateSystemExpressionWithUnits("p22_arclen=0", unit1)
Dim expression24 As NXOpen.Expression = Nothing
expression24 = workPart.Expressions.CreateSystemExpressionWithUnits("p23_percent=0", nullNXOpen_Unit)
expression10.SetFormula("153")
expression11.SetFormula("238")
expression12.SetFormula("385")
expression13.SetFormula("0")
expression14.SetFormula("0")
expression15.SetFormula("0")
expression16.SetFormula("0")
expression17.SetFormula("0")
expression18.SetFormula("0")
expression19.SetFormula("0")
expression20.SetFormula("0")
expression21.SetFormula("0")
expression22.SetFormula("0")
expression24.SetFormula("100")
expression23.SetFormula("0")
theSession.SetUndoMarkName(markId3, "Point Dialog")
Dim expression25 As NXOpen.Expression = Nothing
expression25 = workPart.Expressions.CreateSystemExpressionWithUnits("p24_x=0.00000000000", unit1)
Dim scalar1 As NXOpen.Scalar = Nothing
scalar1 = workPart.Scalars.CreateScalarExpression(expression25, NXOpen.Scalar.DimensionalityType.None, NXOpen.SmartObject.UpdateOption.WithinModeling)
Dim expression26 As NXOpen.Expression = Nothing
expression26 = workPart.Expressions.CreateSystemExpressionWithUnits("p25_y=0.00000000000", unit1)
Dim scalar2 As NXOpen.Scalar = Nothing
scalar2 = workPart.Scalars.CreateScalarExpression(expression26, NXOpen.Scalar.DimensionalityType.None, NXOpen.SmartObject.UpdateOption.WithinModeling)
Dim expression27 As NXOpen.Expression = Nothing
expression27 = workPart.Expressions.CreateSystemExpressionWithUnits("p26_z=0.00000000000", unit1)
Dim scalar3 As NXOpen.Scalar = Nothing
scalar3 = workPart.Scalars.CreateScalarExpression(expression27, NXOpen.Scalar.DimensionalityType.None, NXOpen.SmartObject.UpdateOption.WithinModeling)
Dim point1 As NXOpen.Point = Nothing
point1 = workPart.Points.CreatePoint(scalar1, scalar2, scalar3, NXOpen.SmartObject.UpdateOption.WithinModeling)
expression10.SetFormula("0")
expression11.SetFormula("0")
expression12.SetFormula("0")
expression10.SetFormula("0.00000000000")
expression11.SetFormula("0.00000000000")
expression12.SetFormula("0.00000000000")
expression10.SetFormula("0")
expression11.SetFormula("0")
expression12.SetFormula("0")
expression10.SetFormula("0.00000000000")
expression11.SetFormula("0.00000000000")
expression12.SetFormula("0.00000000000")
expression13.SetFormula("0.00000000000")
expression14.SetFormula("0.00000000000")
expression15.SetFormula("0.00000000000")
expression16.SetFormula("0.00000000000")
expression17.SetFormula("0.00000000000")
expression18.SetFormula("0.00000000000")
expression19.SetFormula("0.00000000000")
expression20.SetFormula("0.00000000000")
expression21.SetFormula("0.00000000000")
expression24.SetFormula("100.00000000000")
' ----------------------------------------------
' Dialog Begin Point
' ----------------------------------------------
Dim markId4 As NXOpen.Session.UndoMarkId = Nothing
markId4 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Point")
theSession.DeleteUndoMark(markId4, Nothing)
Dim markId5 As NXOpen.Session.UndoMarkId = Nothing
markId5 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Point")
expression10.RightHandSide = "0.00000000000"
expression11.RightHandSide = "0.00000000000"
expression12.RightHandSide = "0.00000000000"
workPart.Points.DeletePoint(point1)
Dim expression28 As NXOpen.Expression = Nothing
expression28 = workPart.Expressions.CreateSystemExpressionWithUnits("p10_x=0.00000000000", unit1)
Dim scalar4 As NXOpen.Scalar = Nothing
scalar4 = workPart.Scalars.CreateScalarExpression(expression28, NXOpen.Scalar.DimensionalityType.None, NXOpen.SmartObject.UpdateOption.WithinModeling)
Dim expression29 As NXOpen.Expression = Nothing
expression29 = workPart.Expressions.CreateSystemExpressionWithUnits("p11_y=0.00000000000", unit1)
Dim scalar5 As NXOpen.Scalar = Nothing
scalar5 = workPart.Scalars.CreateScalarExpression(expression29, NXOpen.Scalar.DimensionalityType.None, NXOpen.SmartObject.UpdateOption.WithinModeling)
Dim expression30 As NXOpen.Expression = Nothing
expression30 = workPart.Expressions.CreateSystemExpressionWithUnits("p12_z=0.00000000000", unit1)
Dim scalar6 As NXOpen.Scalar = Nothing
scalar6 = workPart.Scalars.CreateScalarExpression(expression30, NXOpen.Scalar.DimensionalityType.None, NXOpen.SmartObject.UpdateOption.WithinModeling)
Dim point2 As NXOpen.Point = Nothing
point2 = workPart.Points.CreatePoint(scalar4, scalar5, scalar6, NXOpen.SmartObject.UpdateOption.WithinModeling)
theSession.DeleteUndoMark(markId5, Nothing)
theSession.SetUndoMarkName(markId3, "Point")
Try
' Expression is still in use.
workPart.Expressions.Delete(expression10)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression11)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression12)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression13)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression14)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression15)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression16)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression17)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression18)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression19)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression20)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression21)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression22)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression23)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression24)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
workPart.MeasureManager.SetPartTransientModification()
workPart.Expressions.Delete(expression9)
workPart.MeasureManager.ClearPartTransientModification()
theSession.DeleteUndoMark(markId3, Nothing)
Dim point3 As NXOpen.Point3d = New NXOpen.Point3d(0.0, 0.0, 0.0)
Dim orientation1 As NXOpen.Matrix3x3 = Nothing
orientation1.Xx = 1.0
orientation1.Xy = 0.0
orientation1.Xz = 0.0
orientation1.Yx = 0.0
orientation1.Yy = 1.0
orientation1.Yz = 0.0
orientation1.Zx = 0.0
orientation1.Zy = 0.0
orientation1.Zz = 1.0
addComponentBuilder1.SetInitialLocationAndOrientation(point3, orientation1)
Dim movableObjects1(1) As NXOpen.NXObject
Dim component1 As NXOpen.Assemblies.Component = CType(workPart.ComponentAssembly.RootComponent.FindObject("COMPONENT tool1 1"), NXOpen.Assemblies.Component)
movableObjects1(0) = component1
Dim component2 As NXOpen.Assemblies.Component = CType(workPart.ComponentAssembly.RootComponent.FindObject("COMPONENT JP181737/00.02 1"), NXOpen.Assemblies.Component)
movableObjects1(1) = component2
componentNetwork1.SetMovingGroup(movableObjects1)
Dim markId6 As NXOpen.Session.UndoMarkId = Nothing
markId6 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Add Component")
theSession.DeleteUndoMark(markId6, Nothing)
Dim markId7 As NXOpen.Session.UndoMarkId = Nothing
markId7 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Add Component")
Dim markId8 As NXOpen.Session.UndoMarkId = Nothing
markId8 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "AddComponent on_apply")
componentNetwork1.Solve()
componentPositioner1.ClearNetwork()
Dim nErrs1 As Integer = Nothing
nErrs1 = theSession.UpdateManager.AddToDeleteList(componentNetwork1)
Dim nErrs2 As Integer = Nothing
nErrs2 = theSession.UpdateManager.DoUpdate(markId2)
componentPositioner1.EndAssemblyConstraints()
Dim logicalobjects1() As NXOpen.PDM.LogicalObject
addComponentBuilder1.GetLogicalObjectsHavingUnassignedRequiredAttributes(logicalobjects1)
Dim nXObject1 As NXOpen.NXObject = Nothing
nXObject1 = addComponentBuilder1.Commit()
Dim errorList1 As NXOpen.ErrorList = Nothing
errorList1 = addComponentBuilder1.GetOperationFailures()
errorList1.Dispose()
theSession.DeleteUndoMark(markId7, Nothing)
theSession.SetUndoMarkName(markId1, "Add Component")
addComponentBuilder1.Destroy()
workPart.Points.DeletePoint(point2)
Dim nullNXOpen_Assemblies_Arrangement As NXOpen.Assemblies.Arrangement = Nothing
componentPositioner1.PrimaryArrangement = nullNXOpen_Assemblies_Arrangement
theSession.DeleteUndoMark(markId2, Nothing)
theSession.CleanUpFacetedFacesAndEdges()
' ----------------------------------------------
' Menu: Assemblies->Components->Add Component...
' ----------------------------------------------
Dim markId9 As NXOpen.Session.UndoMarkId = Nothing
markId9 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start")
Dim addComponentBuilder2 As NXOpen.Assemblies.AddComponentBuilder = Nothing
addComponentBuilder2 = workPart.AssemblyManager.CreateAddComponentBuilder()
Dim componentPositioner2 As NXOpen.Positioning.ComponentPositioner = Nothing
componentPositioner2 = workPart.ComponentAssembly.Positioner
componentPositioner2.ClearNetwork()
componentPositioner2.PrimaryArrangement = arrangement1
componentPositioner2.BeginAssemblyConstraints()
Dim allowInterpartPositioning2 As Boolean = Nothing
allowInterpartPositioning2 = theSession.Preferences.Assemblies.InterpartPositioning
Dim expression31 As NXOpen.Expression = Nothing
expression31 = workPart.Expressions.CreateSystemExpressionWithUnits("1.0", nullNXOpen_Unit)
Dim expression32 As NXOpen.Expression = Nothing
expression32 = workPart.Expressions.CreateSystemExpressionWithUnits("1.0", unit1)
Dim expression33 As NXOpen.Expression = Nothing
expression33 = workPart.Expressions.CreateSystemExpressionWithUnits("0.0", unit1)
Dim expression34 As NXOpen.Expression = Nothing
expression34 = workPart.Expressions.CreateSystemExpressionWithUnits("0.0", unit2)
Dim expression35 As NXOpen.Expression = Nothing
expression35 = workPart.Expressions.CreateSystemExpressionWithUnits("1", nullNXOpen_Unit)
Dim expression36 As NXOpen.Expression = Nothing
expression36 = workPart.Expressions.CreateSystemExpressionWithUnits("1.0", unit1)
Dim expression37 As NXOpen.Expression = Nothing
expression37 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
Dim expression38 As NXOpen.Expression = Nothing
expression38 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit2)
Dim network2 As NXOpen.Positioning.Network = Nothing
network2 = componentPositioner2.EstablishNetwork()
Dim componentNetwork2 As NXOpen.Positioning.ComponentNetwork = CType(network2, NXOpen.Positioning.ComponentNetwork)
componentNetwork2.MoveObjectsState = True
componentNetwork2.DisplayComponent = nullNXOpen_Assemblies_Component
theSession.SetUndoMarkName(markId9, "Add Component Dialog")
componentNetwork2.MoveObjectsState = True
Dim markId10 As NXOpen.Session.UndoMarkId = Nothing
markId10 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Assembly Constraints Update")
addComponentBuilder2.SetComponentAnchor(nullNXOpen_Assemblies_ProductInterface_InterfaceObject)
addComponentBuilder2.SetInitialLocationType(NXOpen.Assemblies.AddComponentBuilder.LocationType.Snap)
addComponentBuilder2.SetCount(1)
addComponentBuilder2.SetScatterOption(True)
addComponentBuilder2.ReferenceSet = "Unknown"
addComponentBuilder2.Layer = -1
theSession.PdmSession.SetNativeMode(True, False)
theSession.PdmSession.SetNativeMode(False, False)
addComponentBuilder2.ReferenceSet = "Use Model"
addComponentBuilder2.Layer = -1
Dim partstouse3(0) As NXOpen.BasePart
partstouse3(0) = part1
addComponentBuilder2.SetPartsToAdd(partstouse3)
Dim productinterfaceobjects3() As NXOpen.Assemblies.ProductInterface.InterfaceObject
addComponentBuilder2.GetAllProductInterfaceObjects(productinterfaceobjects3)
Dim markId11 As NXOpen.Session.UndoMarkId = Nothing
markId11 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Start")
Dim expression39 As NXOpen.Expression = Nothing
expression39 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
Dim expression40 As NXOpen.Expression = Nothing
expression40 = workPart.Expressions.CreateSystemExpressionWithUnits("p9_x=0.00000000000", unit1)
Dim expression41 As NXOpen.Expression = Nothing
expression41 = workPart.Expressions.CreateSystemExpressionWithUnits("p10_y=0.00000000000", unit1)
Dim expression42 As NXOpen.Expression = Nothing
expression42 = workPart.Expressions.CreateSystemExpressionWithUnits("p11_z=0.00000000000", unit1)
Dim expression43 As NXOpen.Expression = Nothing
expression43 = workPart.Expressions.CreateSystemExpressionWithUnits("p12_xdelta=0.00000000000", unit1)
Dim expression44 As NXOpen.Expression = Nothing
expression44 = workPart.Expressions.CreateSystemExpressionWithUnits("p13_ydelta=0.00000000000", unit1)
Dim expression45 As NXOpen.Expression = Nothing
expression45 = workPart.Expressions.CreateSystemExpressionWithUnits("p14_zdelta=0.00000000000", unit1)
Dim expression46 As NXOpen.Expression = Nothing
expression46 = workPart.Expressions.CreateSystemExpressionWithUnits("p15_radius=0.00000000000", unit1)
Dim expression47 As NXOpen.Expression = Nothing
expression47 = workPart.Expressions.CreateSystemExpressionWithUnits("p16_angle=0.00000000000", unit2)
Dim expression48 As NXOpen.Expression = Nothing
expression48 = workPart.Expressions.CreateSystemExpressionWithUnits("p17_zdelta=0.00000000000", unit1)
Dim expression49 As NXOpen.Expression = Nothing
expression49 = workPart.Expressions.CreateSystemExpressionWithUnits("p18_radius=0.00000000000", unit1)
Dim expression50 As NXOpen.Expression = Nothing
expression50 = workPart.Expressions.CreateSystemExpressionWithUnits("p19_angle1=0.00000000000", unit2)
Dim expression51 As NXOpen.Expression = Nothing
expression51 = workPart.Expressions.CreateSystemExpressionWithUnits("p20_angle2=0.00000000000", unit2)
Dim expression52 As NXOpen.Expression = Nothing
expression52 = workPart.Expressions.CreateSystemExpressionWithUnits("p21_distance=0", unit1)
Dim expression53 As NXOpen.Expression = Nothing
expression53 = workPart.Expressions.CreateSystemExpressionWithUnits("p22_arclen=0", unit1)
Dim expression54 As NXOpen.Expression = Nothing
expression54 = workPart.Expressions.CreateSystemExpressionWithUnits("p23_percent=0", nullNXOpen_Unit)
expression40.SetFormula("0")
expression41.SetFormula("0")
expression42.SetFormula("0")
expression43.SetFormula("0")
expression44.SetFormula("0")
expression45.SetFormula("0")
expression46.SetFormula("0")
expression47.SetFormula("0")
expression48.SetFormula("0")
expression49.SetFormula("0")
expression50.SetFormula("0")
expression51.SetFormula("0")
expression52.SetFormula("0")
expression54.SetFormula("100")
expression53.SetFormula("0")
theSession.SetUndoMarkName(markId11, "Point Dialog")
Dim expression55 As NXOpen.Expression = Nothing
expression55 = workPart.Expressions.CreateSystemExpressionWithUnits("p24_x=0.00000000000", unit1)
Dim scalar7 As NXOpen.Scalar = Nothing
scalar7 = workPart.Scalars.CreateScalarExpression(expression55, NXOpen.Scalar.DimensionalityType.None, NXOpen.SmartObject.UpdateOption.WithinModeling)
Dim expression56 As NXOpen.Expression = Nothing
expression56 = workPart.Expressions.CreateSystemExpressionWithUnits("p25_y=0.00000000000", unit1)
Dim scalar8 As NXOpen.Scalar = Nothing
scalar8 = workPart.Scalars.CreateScalarExpression(expression56, NXOpen.Scalar.DimensionalityType.None, NXOpen.SmartObject.UpdateOption.WithinModeling)
Dim expression57 As NXOpen.Expression = Nothing
expression57 = workPart.Expressions.CreateSystemExpressionWithUnits("p26_z=0.00000000000", unit1)
Dim scalar9 As NXOpen.Scalar = Nothing
scalar9 = workPart.Scalars.CreateScalarExpression(expression57, NXOpen.Scalar.DimensionalityType.None, NXOpen.SmartObject.UpdateOption.WithinModeling)
Dim point4 As NXOpen.Point = Nothing
point4 = workPart.Points.CreatePoint(scalar7, scalar8, scalar9, NXOpen.SmartObject.UpdateOption.WithinModeling)
expression40.SetFormula("0.00000000000")
expression41.SetFormula("0.00000000000")
expression42.SetFormula("0.00000000000")
expression40.SetFormula("0")
expression41.SetFormula("0")
expression42.SetFormula("0")
expression40.SetFormula("0.00000000000")
expression41.SetFormula("0.00000000000")
expression42.SetFormula("0.00000000000")
expression43.SetFormula("0.00000000000")
expression44.SetFormula("0.00000000000")
expression45.SetFormula("0.00000000000")
expression46.SetFormula("0.00000000000")
expression47.SetFormula("0.00000000000")
expression48.SetFormula("0.00000000000")
expression49.SetFormula("0.00000000000")
expression50.SetFormula("0.00000000000")
expression51.SetFormula("0.00000000000")
expression54.SetFormula("100.00000000000")
' ----------------------------------------------
' Dialog Begin Point
' ----------------------------------------------
expression40.SetFormula("100")
workPart.Points.DeletePoint(point4)
expression40.RightHandSide = "100"
expression41.RightHandSide = "0.00000000000"
expression42.RightHandSide = "0.00000000000"
Dim expression58 As NXOpen.Expression = Nothing
expression58 = workPart.Expressions.CreateSystemExpressionWithUnits("p10_x=100", unit1)
Dim scalar10 As NXOpen.Scalar = Nothing
scalar10 = workPart.Scalars.CreateScalarExpression(expression58, NXOpen.Scalar.DimensionalityType.None, NXOpen.SmartObject.UpdateOption.WithinModeling)
Dim expression59 As NXOpen.Expression = Nothing
expression59 = workPart.Expressions.CreateSystemExpressionWithUnits("p11_y=0.00000000000", unit1)
Dim scalar11 As NXOpen.Scalar = Nothing
scalar11 = workPart.Scalars.CreateScalarExpression(expression59, NXOpen.Scalar.DimensionalityType.None, NXOpen.SmartObject.UpdateOption.WithinModeling)
Dim expression60 As NXOpen.Expression = Nothing
expression60 = workPart.Expressions.CreateSystemExpressionWithUnits("p12_z=0.00000000000", unit1)
Dim scalar12 As NXOpen.Scalar = Nothing
scalar12 = workPart.Scalars.CreateScalarExpression(expression60, NXOpen.Scalar.DimensionalityType.None, NXOpen.SmartObject.UpdateOption.WithinModeling)
Dim point5 As NXOpen.Point = Nothing
point5 = workPart.Points.CreatePoint(scalar10, scalar11, scalar12, NXOpen.SmartObject.UpdateOption.WithinModeling)
Dim markId12 As NXOpen.Session.UndoMarkId = Nothing
markId12 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Point")
theSession.DeleteUndoMark(markId12, Nothing)
Dim markId13 As NXOpen.Session.UndoMarkId = Nothing
markId13 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Point")
expression40.RightHandSide = "100"
expression41.RightHandSide = "0.00000000000"
expression42.RightHandSide = "0.00000000000"
workPart.Points.DeletePoint(point5)
Dim expression61 As NXOpen.Expression = Nothing
expression61 = workPart.Expressions.CreateSystemExpressionWithUnits("p10_x=100", unit1)
Dim scalar13 As NXOpen.Scalar = Nothing
scalar13 = workPart.Scalars.CreateScalarExpression(expression61, NXOpen.Scalar.DimensionalityType.None, NXOpen.SmartObject.UpdateOption.WithinModeling)
Dim expression62 As NXOpen.Expression = Nothing
expression62 = workPart.Expressions.CreateSystemExpressionWithUnits("p11_y=0.00000000000", unit1)
Dim scalar14 As NXOpen.Scalar = Nothing
scalar14 = workPart.Scalars.CreateScalarExpression(expression62, NXOpen.Scalar.DimensionalityType.None, NXOpen.SmartObject.UpdateOption.WithinModeling)
Dim expression63 As NXOpen.Expression = Nothing
expression63 = workPart.Expressions.CreateSystemExpressionWithUnits("p12_z=0.00000000000", unit1)
Dim scalar15 As NXOpen.Scalar = Nothing
scalar15 = workPart.Scalars.CreateScalarExpression(expression63, NXOpen.Scalar.DimensionalityType.None, NXOpen.SmartObject.UpdateOption.WithinModeling)
Dim point6 As NXOpen.Point = Nothing
point6 = workPart.Points.CreatePoint(scalar13, scalar14, scalar15, NXOpen.SmartObject.UpdateOption.WithinModeling)
theSession.DeleteUndoMark(markId13, Nothing)
theSession.SetUndoMarkName(markId11, "Point")
Try
' Expression is still in use.
workPart.Expressions.Delete(expression40)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression41)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression42)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression43)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression44)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression45)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression46)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression47)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression48)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression49)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression50)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression51)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression52)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression53)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression54)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
workPart.MeasureManager.SetPartTransientModification()
workPart.Expressions.Delete(expression39)
workPart.MeasureManager.ClearPartTransientModification()
theSession.DeleteUndoMark(markId11, Nothing)
Dim point7 As NXOpen.Point3d = New NXOpen.Point3d(100.0, 0.0, 0.0)
Dim orientation2 As NXOpen.Matrix3x3 = Nothing
orientation2.Xx = 1.0
orientation2.Xy = 0.0
orientation2.Xz = 0.0
orientation2.Yx = 0.0
orientation2.Yy = 1.0
orientation2.Yz = 0.0
orientation2.Zx = 0.0
orientation2.Zy = 0.0
orientation2.Zz = 1.0
addComponentBuilder2.SetInitialLocationAndOrientation(point7, orientation2)
Dim movableObjects2(0) As NXOpen.NXObject
Dim component3 As NXOpen.Assemblies.Component = CType(workPart.ComponentAssembly.RootComponent.FindObject("COMPONENT tool1 1"), NXOpen.Assemblies.Component)
movableObjects2(0) = component3
componentNetwork2.SetMovingGroup(movableObjects2)
Dim markId14 As NXOpen.Session.UndoMarkId = Nothing
markId14 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Add Component")
theSession.DeleteUndoMark(markId14, Nothing)
Dim markId15 As NXOpen.Session.UndoMarkId = Nothing
markId15 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Add Component")
Dim markId16 As NXOpen.Session.UndoMarkId = Nothing
markId16 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "AddComponent on_apply")
componentNetwork2.Solve()
componentPositioner2.ClearNetwork()
Dim nErrs3 As Integer = Nothing
nErrs3 = theSession.UpdateManager.AddToDeleteList(componentNetwork2)
Dim nErrs4 As Integer = Nothing
nErrs4 = theSession.UpdateManager.DoUpdate(markId10)
componentPositioner2.EndAssemblyConstraints()
Dim logicalobjects2() As NXOpen.PDM.LogicalObject
addComponentBuilder2.GetLogicalObjectsHavingUnassignedRequiredAttributes(logicalobjects2)
addComponentBuilder2.ComponentName = "TOOL1"
Dim nXObject2 As NXOpen.NXObject = Nothing
nXObject2 = addComponentBuilder2.Commit()
Dim errorList2 As NXOpen.ErrorList = Nothing
errorList2 = addComponentBuilder2.GetOperationFailures()
errorList2.Dispose()
theSession.DeleteUndoMark(markId15, Nothing)
theSession.SetUndoMarkName(markId9, "Add Component")
addComponentBuilder2.Destroy()
workPart.Points.DeletePoint(point6)
componentPositioner2.PrimaryArrangement = nullNXOpen_Assemblies_Arrangement
theSession.DeleteUndoMark(markId10, Nothing)
theSession.CleanUpFacetedFacesAndEdges()
' ----------------------------------------------
' Menu: Tools->Journal->Stop Recording
' ----------------------------------------------
End Sub
End Module