Looking for a way to detect undefined entities in a sketch

Obviously entities in a solidworks sketch change their color from blue to black once fully defined. In some cases a user might have drown a small (undefined) entity which might be difficult to spot at the end of the sketching process, it would be helpful to have a method which would count (and maybe even locate undefined entities).

Has someone ever pondered about this ?

Since solidworks changes the color when an entity becomes fully defined it might be possible that one can query this state somewhere.

SolidworksApi macros
Answers 4
DG
DG 2013-10-23 Best Answer

Not sure if there are API codes to do so but within open sketch go to Tools > Sketch Tools > Check sketch for feature. Choose feature from the list and SW will find any issues with the sketch (which might include small entities)

SF
SF 2013-10-23

Thanks for your reply.

We had the cases that the "Sketch for feature" did not always find the undefined entity. I have begun to traverse an open sketch and look for the colors of the entities ... this means to look for entities which are not black (which is a bad idea in any case ... because the color for defined or undefined entities in a sketch is customizable). So best would be to go for the Status of a sketchSegment, however the Status is not a property (at least not officially) of solidworks 2013 ... while I still work with solidworks2011 it would be preferably to use something which will be maintained in the future

vSketchSegments = swSketch.GetSketchSegments

For Each vSketchSegment In vSketchSegments

if (swSketchSegment.Status = 2) then  ...

DG
DG 2013-10-23

Found this example for SW2011 Autodimension All Sketches Example (VBA)

Using this macro (after removing the codes you don't need) you can at least find as which sketch has under defined sketch entity.

SF
SF 2013-10-24

I have contacted the API Support and as I understand it the documenation is not correct, thus the ISketchSegment.status property might be "official" ... however the answer I received stated only that the documenation did not cover the property as it should .... so I am not 100% sure about my deduction and I have asked the support again. I have not received an answer yet - but non-the-less I am optimistic.