Inventor Professional 2021 Dimension text

Inventor Professional 2021 Dimension text

richard_griffin
Enthusiast Enthusiast
705 Views
5 Replies
Message 1 of 6

Inventor Professional 2021 Dimension text

richard_griffin
Enthusiast
Enthusiast

Is it possible to add text to iLogic created dimensions using the new snippets in 2021?

 

For example, if I have a dimension created using this-

 

Dim linDim2 = genDims.AddLinear("Dimension 2", VIEW1.SheetPoint(-0.1, -0.1), Edge3)

and it dimensions at 400, is there a way to have it say "400 centres"? 

0 Likes
Accepted solutions (1)
706 Views
5 Replies
Replies (5)
Message 2 of 6

JhoelForshav
Mentor
Mentor

Hi @richard_griffin 

Try this 🙂

Dim linDim2 = genDims.AddLinear("Dimension 2", VIEW1.SheetPoint(-0.1, -0.1), Edge3)
linDim2.Text.FormattedText = linDim2.Text.FormattedText & " centres"
0 Likes
Message 3 of 6

JhoelForshav
Mentor
Mentor

Seems to work even better if you just do it like this.

The dimension is kept if "Hide dimension value" isn't checked in the dimension...

Dim linDim2 = genDims.AddLinear("Dimension 2", VIEW1.SheetPoint(-0.1, -0.1), Edge3)
linDim2.Text.FormattedText = " centres"

 

Message 4 of 6

richard_griffin
Enthusiast
Enthusiast

Close, but no cigar.

 

Error on Line 29 : 'Text' is not a member of 'Autodesk.iLogic.Interfaces.IManagedLinearGeneralDimension'.

 

I'm not sure if the IManaged thing is specifically for 2021 drawing iLogic or if its something that's always been around.

0 Likes
Message 5 of 6

JhoelForshav
Mentor
Mentor
Accepted solution

Hi @richard_griffin 

Sorry, I dont have 2021. I thought it would return a LinearGeneralDimension.

Seems like

linDim2.NativeEntity

is of type LinearGeneralDimension though, so this should work? 🙂

linDim2.NativeEntity.Text.FormattedText = " centres"
Message 6 of 6

richard_griffin
Enthusiast
Enthusiast

You're a legend, I had no idea what a nativeEntity was so didnt look at it. Thanks a bunch mate.