Get Drawing Dimension Displayed Value using iLogic

Get Drawing Dimension Displayed Value using iLogic

Anonymous
Not applicable
2,349 Views
7 Replies
Message 1 of 8

Get Drawing Dimension Displayed Value using iLogic

Anonymous
Not applicable

I'm trying to iterate through each dimension value and compare the displayed value to the model value.

 

Using this script: http://inventortrenches.blogspot.co.uk/2011/06/using-ilogic-to-find-dimension.html, oDrawingDims.Tex... will get all text that is displayed but I just want to retrieve the displayed dimension value (See screenshots).

 

Is this possible?

0 Likes
2,350 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable

Above hasn't formatted properly.

 

 

Link is: http://inventortrenches.blogspot.co.uk/2011/06/using-ilogic-to-find-dimension.html

 

Should say: oDrawingDims.Text.Text

0 Likes
Message 3 of 8

MechMachineMan
Advisor
Advisor

Autodesk's Online Help - Developer Documentation has all of the information you seek.

 

ex:// http://help.autodesk.com/view/INVNTOR/2018/ENU/?guid=GUID-6BB164C1-53DE-43E8-94D1-5F232AF9D4D5

 

 


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

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 4 of 8

Anonymous
Not applicable

So it is not possible?

0 Likes
Message 5 of 8

MechMachineMan
Advisor
Advisor

You must have skipped over the line:

 

OverrideModelValue	Gets and sets the NominalValue setting.

 

or the line that hints to it being possible:

 

ModelValueOverridden	Read-write property that gets and sets whether the model value is overridden for the dimension.

and the fact that it shows the main value is available: 

 

 

ModelValue	Property that gets the dimension value as defined in the model or as measured in the drawing.

or the fact that you can just directly access the text: 

 

Text	Gets and sets the DimensionText setting.

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

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 6 of 8

Anonymous
Not applicable

I should clarify. I just want to retrieve the displayed dimension, nothing else.

 

I understand that you can get ModelValueOverridden, ModelValue and Text but I'm asking whether its possible to get the displayed dimension (with no additional text)?

 

The reason I want to do this is if for a particular dimension, the ModelValue is 149.5 but the displayed value on the drawing is 150 (0 d.p. precision), I want to flag this up.

 

This is why I want to compare the dimension ModelValue to its displayed value and check if they are different. (I want to ignore any additional text that may be in DimensionText.Text).

 

 

0 Likes
Message 7 of 8

MechMachineMan
Advisor
Advisor

So this is all information I deciphered by using the vba editor to test the object - something completely available for you to do. I suggest you read up on debugging and using watches/immediate window for VBA/Vb.net/Visual Studio/IDE's.

 

 

 

If a user manually overrides the text value and clicks the textbox, here's what happens: (Using 149.5 overriden to 150)

 

 

Modelvalue - Returns model value as a double, in database units (cm)  (379.73 cm)

OverrideModelValue - Returns dimension value as a double, in database units. (381 cm)

.Text.Text - Returns the actual text as it appears in the box (150 in)

.Text.FormattedText still shows "</DimensionValue>"

IF the user changes the precision to very low, hiding decimals:

 

Modelvalue - Returns model value as a double, in database units (cm) (379.73 cm)

OverrideModelValue - Returns dimension value as a double, in database units. (379.73 cm)

.Text.Text - Returns the actual text as it appears in the box (150 in)

.Text.FormattedText still shows "</DimensionValue>"

 

 


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

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 8 of 8

Anonymous
Not applicable

Thanks for the information and your help.

 

So for the case IF the user changes the precision to very low, hiding decimals, ModelValue and OverrideModelValue are the same even though the displayed value could be different (149.5 ModelValue becomes 150).

 

.Text.Text returns the actual text in the box so if the user adds some text to the box, e.g. "TYP", .Text.Text and ModelValue will be different even though the displayed value and ModelValue could be the same (149.5 ModelValue and "149.5 TYP" text). 

 

This is also the case for .Text.FormattedText which would return "</DimensionValue> TYP" which is also not the displayed dimension value.

 

 

I've managed to resolve my issue with the following code:

 

 

ModelValueMM = CStr(Round((CDbl(oDrawingDims.ModelValue)*10),2)) 'Convert model value from cm to mm and round to two d.p.s

ModelValueMMDP = ModelValueMM - Int(ModelValueMM) ' Extract d.p. value

 

I then ignore angular dimensions and use the following if statement: 

 

if oDrawingDims.Type <> 117474816 _ 'if dimension type is not an angle
and (ModelValueMMDP <> 0 and oDrawingDims.Precision = 0) then 'if model value d.p. is different from displayed value

 

 

0 Likes