2 Replies Latest reply on Jan 12, 2014 9:30 PM by Keith Rice

    Get the dimension created by a sketch offset

    Keith Rice



      Can anyone think of a way to get the dimension that is automatically created by a sketch offset? For example, in the attached image, assume that the dimension you see is named "D1@Sketch1". How do I determine that D1@Sketch1 was used to created the offset you see?


      Unfortunately, IAnnotation::GetAttachedEntities3 does not return the entities the sketch offset dimension is attached to. Here are the possible relations associated with a sketch offset:


      swConstraintType_OFFSETEDGE (16) - When using an external reference.

      swConstraintType_SKETCHOFFSET (47) - When using an internal reference.


      IDisplayDimension::Type2 returns swLinearDimension for an offset dimension, so that isn't very useful.


      At this point, the best approach I can think of is to get the extension line start points of each dimension, and see if those start points correspond to the locations of the entities returned by ISketchRelation::GetDefinitionEntities2. Yuck.





      SolidWorks API Tutorials