Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Find Instance Name from Selecting Edge Using SelectElement2

Status
Not open for further replies.

blues1143

Computer
Nov 22, 2016
14
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
 
Replies continue below

Recommended for you

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
 
Hi,

I am after a script...

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

Thanks
 
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
 
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

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

or something like that


Eric N.
indocti discant et ament meminisse periti
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor