iLogic Measure x,y,z of ucs into Custom-iProperty

iLogic Measure x,y,z of ucs into Custom-iProperty

christoph.aignerWYYEA
Advocate Advocate
1,412 Views
6 Replies
Message 1 of 7

iLogic Measure x,y,z of ucs into Custom-iProperty

christoph.aignerWYYEA
Advocate
Advocate

Hello.

 

I am searching the entire web of measuring a solid part from ucs with iLogic but i haven't found any solutions for me. I want to measure/output the x,y,z from my ucs into a Custom iProperty with iLogic. In this picture you can see that my plate is not plane on the origin axes.

 

I appreciate any help.

Thanks.

Chris

UCS_CS.jpg

...
0 Likes
Accepted solutions (1)
1,413 Views
6 Replies
Replies (6)
Message 2 of 7

bradeneuropeArthur
Mentor
Mentor

This is not easily possible, but take a look at one of my ideas in the idea-station.

If you like you could vote it and maybe it will be implemented in future.

Dimension Component! 


Regards,

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 7

fullevent
Advisor
Advisor

Hello @christoph.aignerWYYEA,

 

i'm not sure if i understood your wish correctly. is it possible to manually visualize in a screencast what you would like to do with iLogic?

Would be greate. Thank you.

 

regards


Aleksandar Krstic
Produkt- und Projektmanager

0 Likes
Message 4 of 7

bradeneuropeArthur
Mentor
Mentor

Hi,

 

Think that @christoph.aignerWYYEA would like to measure the model according a "User Defined Coordinate" System.

This would also be my wish to be implemented.

 

Please correct me if i am wrong @christoph.aignerWYYEA  

 

Regards,

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 7

christoph.aignerWYYEA
Advocate
Advocate

@fullevent 


@bradeneuropeArthur  schrieb:

Hi,

 

Think that @christoph.aignerWYYEA would like to measure the model according a "User Defined Coordinate" System.

This would also be my wish to be implemented.

 

Please correct me if i am wrong @christoph.aignerWYYEA  

 

Regards,


Exactly! For example i have a model diagonal throw the middle of the standard ucs so i am creating a custom ucs on one edge of my model and aligne it on a flat surface. Then i want to know the max. x,y,z of my model with an i-logic code.

 

This is my i-logic code, it's a easy code to measure and save x,y,z dimensions.

iProperties.Value("Custom", "L x B x H") = Round(Measure.ExtentsLength, 0) & " x " & Round(Measure.ExtentsWidth, 0) & " x " & Round(Measure.ExtentsHeight, 1)

But i don't want to measure the extents lenght of my standard ucs. I want to measure from a custom ucs which is set by my own on any edge or point. I know my ilogic code wont work very well, i need instead some rangeboxes or something else...!?

 

Thanks

Chris

...
0 Likes
Message 6 of 7

JelteDeJong
Mentor
Mentor
Accepted solution

Did you see the code from @JamieVJohnson2 in this post:

https://forums.autodesk.com/t5/inventor-customization/bounding-box-with-the-ucs-origin/m-p/8505370/h... 

 

i altered his code slightly and i think it does what you want

Dim partDoc As PartDocument = ThisApplication.ActiveDocument
'get 3d solid
Dim sb As SurfaceBody = partDoc.ComponentDefinition.SurfaceBodies.Item(1)
'get custom user coordinate system
Dim ucs As UserCoordinateSystem = partDoc.ComponentDefinition.UserCoordinateSystems(1)
'create a list of points (for sorting)
Dim vPoints As New List(Of Point)
'get the transformation matrix from the usc (what it takes to translate from user ucs to origin)
Dim mat As Matrix = ucs.Transformation
'invert the matrix (what it takes to translate from origin to user ucs)
mat.Invert()
'cycle through all the points
For Each vert As Vertex In sb.Vertices
    'get the point data from the vertex
    Dim p As Point = vert.Point
    'invert translate the point data (from origin to user ucs)
    p.TransformBy(mat)
    'add translated point to collection
    vPoints.Add(p)
Next
Dim tg = ThisApplication.TransientGeometry
'create empty min and max points
Dim minPoint As Point = tg.CreatePoint(0, 0, 0)
Dim maxPoint As Point = tg.CreatePoint(0, 0, 0)
'sort points based on x values, and get lowest and highest value
vPoints.Sort(Function(x, y) x.X.CompareTo(y.X))
minPoint.X = vPoints.First.X
maxPoint.X = vPoints.Last.X
'sort points based on y values, and get lowest and highest values
vPoints.Sort(Function(x, y) x.Y.CompareTo(y.Y))
minPoint.Y = vPoints.First.Y
maxPoint.Y = vPoints.Last.Y
'sort points based on z values, and get lowest and highest values
vPoints.Sort(Function(x, y) x.Z.CompareTo(y.Z))
minPoint.Z = vPoints.First.Z
maxPoint.Z = vPoints.Last.Z

Dim sizeX As Double = Math.Abs(maxPoint.X - minPoint.X)
Dim sizeY As Double = Math.Abs(maxPoint.Y - minPoint.Y)
Dim sizeZ As Double = Math.Abs(maxPoint.Z - minPoint.Z)

Dim outerDim As String = String.Format("{0} x {1} x {2}", sizeX*10, sizeY*10, sizeZ*10)

iProperties.Value("Project", "Description") = outerDim
MsgBox("see iproperty description: " & outerDim)

.

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 7 of 7

christoph.aignerWYYEA
Advocate
Advocate

@JelteDeJongyeah i found @JamieVJohnson2 code but it doesn't worked that way i wanted to.

Your modified code is working very well for my task.

I am not in codeing very well. In school we learned c++, vba and html/php but nowadays i didn't need it that much. I will make some adjustments on this code so it will be more fitted on my needs.

 

Many thanks to @JelteDeJong  👏

 

...
0 Likes