5 Replies Latest reply on Jan 9, 2014 4:08 PM by Keith Rice

# Determine whether a linear dimension's dimension line is diametric or radial

As some of you know, you can create a diameter dimension as shown in the attached image. Can you think of any way to do either of the following:

1. Determine whether the linear dimension is diametric or radial.

2. Toggle whether the linear dimension is diametric or radial.

The first one is of greatest importance. For the second one, I thought that something in swCommands_e might toggle it, but nothing I have tried has worked.

Keith

SolidWorks API Training

• ###### Re: Determine whether a linear dimension leader line is diametric or radial

Discovered that the sketch relation type (defined in swConstraintType_e) is DOUBLEDISTANCE. So this could be used to identify a diametric linear dimension is present. Unfortunately there's no way to access the corresponding IDisplayDimension or IDimension pointer from that relation, however. To get that dimensions IDisplayDimension pointer, I may need to use IDisplayData::GetLineAtIndex3 to determine whether the centerline bisects the dimension line. (It appears that only lines can be used to create diametric linear dimensions.)

I still have not discovered a way to actually create a diametric linear dimension, however, using the API.

Keith

SolidWorks API Tutorials

• ###### Re: Determine whether a linear dimension leader line is diametric or radial

I _knew_ that I had seen "Doubled Distance" somewhere before...

I am just inferring here, but I think to add the diametric linear dimension you would need to actually create a relation, not a dimension.  If you look at the properties of iSketchRelation[s] you'll see a "GetEntities" and "GetDefinitionEntities".  I'm pretty sure that the dimension is one of the entities that is created, because swSketchRelationEntityType_Dimension is one of the possible returns of GetEntitiesType.

I'm guessing one of the other entities that gets returned by GetDefinitionEntities is an invisible line/point on the other side of the centerline.

I'm not sure how you would go about editing the definition of an existing relation to change it from radial to diametric.  You may end up having to delete it and recreate it through the SketchRelationManager.

• ###### Re: Determine whether a linear dimension leader line is diametric or radial

Josh,

• Unfortunately, both GetEntities and GetEntitiesDefinition2 return ISketchSegment for the two segments you see in the image, and not IDisplayDimension.
• In my experience, relations that correspond to dimensions, sketch offsets, and convert entities can only be created when you create those items. If you know of a way to create these relations directly, I'd love to know about it.

If you want to play around with GetEntities and GetDefinitionEntities2, I have already set up a macro that will take you pretty far. See attached.

Keith

SolidWorks API Tutorials