how to find if a dimension has a diameter

^_^clovis^_^
Advocate
Advocate

how to find if a dimension has a diameter

^_^clovis^_^
Advocate
Advocate

Hello,

 

I have a dimension on a cylinder. The dimension style -> option -> diameter dimension is set with symbol.

_clovis__0-1683557968971.png

in VBA the dimension text is "n291". It contains a "n" which is the diameter symbol in font "AMGDT".

the dimention.formattedText doesn't contain info about the symbol used. It's just "<DimensionValue/>", indicating no formatting.

_clovis__1-1683558344495.png

 

My question: where can I find the info/property of the dimension telling me if a symbol is used or not?

 

Thanks

Regards.

 

 

0 Likes
Reply
Accepted solutions (1)
525 Views
4 Replies
Replies (4)

WCrihfield
Mentor
Mentor

Hi @^_^clovis^_^.  You can check in the GeneralDimension.Style, which returns a DimensionStyle object, which you can then check its DimensionStyle.DiameterShowDiameterSymbol property value, which is Boolean.  But beware changing its value, because that will effect all new locally created dimensions in that document, and also any already existing dimensions in that drawing that are using that same style.  And you will also end up with a local style named the same as a library style, but with different settings.  If variations in style settings are needed, it is always best to simply create a new style, and name it accordingly, then use that other style.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes

^_^clovis^_^
Advocate
Advocate

Hello WCrihfield,

 

Thanks for your reaction.

I Don't want to change the general dimension style. What I'm looking for, is a property in the dimension (KLinearGeneralDimensionObject) indicating if it contains a diameter symbol (according to the rule in the general dimension style). I also could test/parse the first character of the dimension.Text.Text. If it contains a "n" then symbol=diameter. But I'm hoping to find a parameter like "isDiameter=true".

I'm thinking about using this property:

oDim.IntentOne.Geometry.curveType and check the enum. is it safe?

 

Thanks for any idea.

Regards.

 

0 Likes

Michael.Navara
Advisor
Advisor
Accepted solution

I don't know there is something like "IsDiameter" property.

 

Check GeometryIntent of dimension is possible, but it is not straightforward. When user selects "cylinder base" (2), you are OK, because you obtain kCircleCurve.  But when user selects "cylinder sides" (3) you obtain kLineSegmentCurve. You can check if the IntentOne and IntentTwo belongs to the same cylinder face in model, but .... BLEH 😓 

 

You can check if the Text starts with 'n' but be careful for cases (4) (manually added 'n' at the beginning) and (5) (manually added 'diameter' at the beginning)

 

Possible condition can be:

Text.StartsWith("n") AND FormattedText.StartsWith("<DimensionValue/>") OR FormattedText.StartsWith("<StyleOverride Font='AIGDT'>n</StyleOverride><DimensionValue/>")

 

MichaelNavara_1-1683644983058.png

 

 

 

 

0 Likes

^_^clovis^_^
Advocate
Advocate

Hello Michael,

Thanks for you well noted points.

I'm afraid there's no other way than using multiple check/parsing to evaluate a dimension value.

Thanks again

Regards

0 Likes