AnsweredAssumed Answered

Get Centermark from DisplayDimension

Question asked by John Alexander on Apr 12, 2018
Latest reply on Apr 25, 2018 by John Alexander

I'm trying to detect when a particular Centermark has a dimension attached to it.

 

 

I've written the following (incomplete) function that I would like to return true when swDisplayDimension is attached to swCenterMark.

 

         private bool IsAttachedToCenterMark(DisplayDimension swDisplayDimension, CenterMark swCenterMark){

             Annotation swAnnotation = (Annotation)(swDisplayDimension.GetAnnotation());

             if(swAnnotation !=  null){

                 object[] oEntities  = (object[])(swAnnotation.GetAttachedEntities3());

                 int[] entityTypes = (int[])(swAnnotation.GetAttachedEntityTypes());

                 for(int i = 0; i < oEntities.Length; i++){

                     object oEntity = oEntities[i];

                     int entityType = entityTypes[i];

                     if(entityType == (int)swSelectType_e.swSelEXTSKETCHSEGS){

                         //This appears to be the value that is returned for centermarks, I'm interpreting this to mean "Extension Line"

                         SketchSegment swSketchSeg = (SketchSegment )oEntity;

                         swSketchSeg.Select4(false,null);

                         //I'm not sure what to do with this from here. Selection doesn't reveal what this is.

                     }else if(entityType == (int)swSelectType_e.swSelEDGES){

                         Entity attachedEntity = (Entity)oEntity;

                         attachedEntity.Select4(false, null);

                         //When I put the breakpoint here, I can observe that it successfully selects the edge.

                     }

                 }

             }

             return false;

         }

 

When I put the breakpoint in the swSelEDGES block, it successfully selects that edge.

 

What I can't figure out is whether or not the dimension's Extension line is being returned or if the CenterMark's line is being returned and it just decides to call it a swSelEXTSKETCHSEGS. Also, in either case, I have no idea how I'm going to go from either of those objects to the CenterMark in question without using some ugly selection Manager stuff.

 

 

I've looked through the API documentation for CenterMark, Annotation, Dimension, DisplayDimension, SketchSegment, and I'm not finding anything promising. Does anyone have any ideas?

Outcomes