Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

AssociativeLine to Line 1

Status
Not open for further replies.

Twullf

Mechanical
Jan 24, 2012
196
I am trying to get a line from a passed AssociativeLineBuilder from a Line created in another Sub Routine. The journal selects the line calling for the name, I am trying to avoid this since I plan on calling this multiple times. The previous subroutine only uses the builder class, so I do not yet have the feature identified as Line.

Recoded journal code:
Code:
Dim line2 As Line = CType(associativeLine1.FindObject("CURVE 1"), Line)

Here is my code as it currently stands
Code:
   Dim feature1 As Features.Feature
   feature1 = associativeLineBuilder1.commitFeature()
   Dim associativeLine1 As Features.associativeLine = CType(feature1, Features.associativeLine)

   Dim line2 As Line = CType( associativeLine1, Line )

The problem is in defining the line. I know there should be a way.

Error says: Value of type 'NXOpen.Features.AssociativeLine' cannot be converted to NXOpen.Line

I do not want the program selecting the component by the name, but rather passing the value of the currently created components.

Any help would be appreciated.
 
Replies continue below

Recommended for you

Edit: The initial journal recording as posted, was not finding the physical line but a feature of that line, I think. There is a previous entry which finds the external line, which calls associative line to do so, so easily converted. Now the question is, What is "Curve 1" and how do I generalize it so that it will find this object on every line that is run through the code?

Recorded journal code is as follows, more complete:
Code:
Dim associativeLine1 As Features.AssociativeLine = CType(workPart.Features.FindObject("LINE(3)"), Features.AssociativeLine)

Dim line2 As Line = CType(associativeLine1.FindObject("CURVE 1"), Line)

Thanks again for any help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor