Twullf
Mechanical
- Jan 24, 2012
- 196
I have code which successfully creates a point. I want to give that point a name so I can reference it later. At least that is the hope.
I want to name it without telling the program to look for a previously named point. Reason is basically if a user puts a point or anything in the modeler before the program is run, it will increment the feature number and then the selection will no longer work. I want to ensure that the point and later features are named at the time of creation in order to ensure the program selects the correct feature when building from it.
I'm open to being told there is a better way to do the selection process for each subsequent feature.
Code:
strExp1 = "p" & counter & "=0"
expression1 = workPart.Expressions.CreateSystemExpressionWithUnits( strExp1, unit1 )
scalar2 = workPart.Scalars.CreateScalarExpression(expression1, Scalar.DimensionalityType.None, SmartObject.UpdateOption.WithinModeling)
point1 = workPart.Points.CreatePoint(spline1, scalar2, SmartObject.UpdateOption.WithinModeling)
strExp2 = "E" & counter & "_arclen=S" & counter
expression2 = workPart.Expressions.CreateSystemExpressionWithUnits( strExp2, unit1 )
scalar1 = workPart.Scalars.CreateScalarExpression(expression2, Scalar.DimensionalityType.None, SmartObject.UpdateOption.WithinModeling)
point2 = workPart.Points.CreatePoint(spline1, point1, scalar1, PointCollection.AlongCurveOption.Distance, Sense.Forward, SmartObject.UpdateOption.WithinModeling)
'-------------------------------------------------------------------
' Naming beginning here. requires feature.point feature which calls for previously "named" point,
'-------------------------------------------------------------------
Dim pointFeature1 As Features.PointFeature = CType(workPart.Features.FindObject("POINT(17)"), Features.PointFeature)
pName = "Point S" & counter
point2.SetName(pName)
I want to name it without telling the program to look for a previously named point. Reason is basically if a user puts a point or anything in the modeler before the program is run, it will increment the feature number and then the selection will no longer work. I want to ensure that the point and later features are named at the time of creation in order to ensure the program selects the correct feature when building from it.
I'm open to being told there is a better way to do the selection process for each subsequent feature.