Get coords of child wrt parent

Get coords of child wrt parent

CadUser46
Collaborator Collaborator
402 Views
4 Replies
Message 1 of 5

Get coords of child wrt parent

CadUser46
Collaborator
Collaborator

I'm hoping to do something with TextGraphics and was trying to find the position of each child (either origin or rough cog) from within the parents space.  I don't want to dirty each child file by creating transient geometry within each child.

 

I found odoc.ComponentDefinition.Occurences.Item(i).OccurenPath.Item(1).RangeBox.Max/Min

 

Is there a better way than rather than computing the centre of this range box?

 


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
0 Likes
403 Views
4 Replies
Replies (4)
Message 2 of 5

chandra.shekar.g
Autodesk Support
Autodesk Support

@CadUser46,

 

Origin of occurrence may not accurate center point. I think that Rangebox (Max and Min) coordinates can be used to calculate center of occurrence.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 3 of 5

CadUser46
Collaborator
Collaborator

@chandra.shekar.g   I had a go with range max/min but it produces a few odd results.  The values extend to include the origin of the parent so in cases where something has been modelled off axis, they resulting (max+min)/2 calc puts the text floating in space, rather than centred on the child.  In many other cases where the modelling is sound, it still puts the text off centre.


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
0 Likes
Message 4 of 5

CadUser46
Collaborator
Collaborator

I'm posting this for completeness.  I ended up changing direction and just handling the dirtying of each child file.

 

So now i am iterating each component occurrence, placing TextGraphics at each origin, dirtying each file but then setting the dirty flag back to false.  It appears robust enough for what i need so i'll live with it for now.


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
0 Likes
Message 5 of 5

YuhanZhang
Autodesk
Autodesk

If you just want to place your text graphics on the child occurrence's origin(the Origin work point) in assembly context, you just need to get the WorkPointProxy of the occurrence's origin in assembly, and place your text graphics at the WorkPointProxy position. You can search the "CreateGeometryProxy" in Inventor API help if you are not sure how to create a WorkPointProxy.

 

Hope this helps.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes