×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Find Instance Name from Selecting Edge Using SelectElement2

Find Instance Name from Selecting Edge Using SelectElement2

Find Instance Name from Selecting Edge Using SelectElement2

(OP)
Hello,

I need to know the coordinates of a point within a CATPart with respect to the CATProduct/Assembly origin.

How can I do this?

Cheers

RE: Find Instance Name from Selecting Edge Using SelectElement2

check FAQ for point in part and do some math to get position from root product. This is if you're looking for script.

If you need manual info, then double click the reference you want to use - defined by the blue level - (root product or sub level par) then use the measure tool...

Eric N.
indocti discant et ament meminisse periti

RE: Find Instance Name from Selecting Edge Using SelectElement2

(OP)
Hi,

I am after a script...

What Math would I use to get position from the root product?!

Thanks

RE: Find Instance Name from Selecting Edge Using SelectElement2

if google math did not work then try matrix math... if you having problem with matrix math then go back to google math

Eric N.
indocti discant et ament meminisse periti

RE: Find Instance Name from Selecting Edge Using SelectElement2

(OP)
Okay sorted that out.

Finally.... how can I get the instance name of the part in a product if I select an edge on the part using selectelement2?

Cheers

RE: Find Instance Name from Selecting Edge Using SelectElement2

selection.item(1).Value.Parent.Parent.Parent.Parent

or something like that

Eric N.
indocti discant et ament meminisse periti

RE: Find Instance Name from Selecting Edge Using SelectElement2

(OP)
Unfortunately that didn't work! Any ideas... I have my code below


CODE -->

Dim InputObject(0)
InputObject(0) = "Edge"

Dim coord(2) As Variant

Set ocentre = CATIA.ActiveDocument.Selection
Status = ocentre.SelectElement2(InputObject, "Select Circle", False)
Set otemp = ocentre.Item(1)
Set oprod = ocentre.FindObject("CATIAPart")
Set partDocument1 = documents1.Item(oprod.Parent.Name)
Set oPart = partDocument1.Part
Set ohsf = oPart.HybridShapeFactory
Set oRef = otemp.Reference
Set opoint = ohsf.AddNewPointCenter(oRef)
opoint.Compute
opoint.GetCoordinates coord

MsgBox ocentre.Item(1).Value.Parent.Parent.Parent.Parent.Name 'This is the line I need to get the instance name of the part the selected edge is on!

End 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources