AnsweredAssumed Answered

Problem with dimensions (addDimension2 returns NULL/fails)

Question asked by Markus Greger on May 31, 2017

Dear Solidworks team,


i have a simple problem:


given an assembly and a set of 3xN appropriate points (p1_i, p2_i p3_i) (i=1..N).


For simplicity assume (p1_i, p2_i p3_i) lie a plane parallel to one of the stdandard planes

(right left top bottom front back).


We want to ROBUSTLY add dimensions to our assembly.

Our current method is (via API-calls in C++):

-Initially we create a 3dsketch.

- For each i

           -we rotate the view to be perpendicular

            to the plane defined by (p1_i, p2_i p3_i). 

           -we create two sketch-points p1_i and p2_i (and select them ALWAYS successfully)

           -we use p3_i and addDimension2 to place the dimensioning


However there are cases in which addDimension2 fails (return NULL/Fails).

It would be very helpful if you could provide us with a robust workflow to

implement this task (preferably independent of the the current view or the

need to change the view to place the dimensions)


in the attachment please find the files cube_dimension.swp.SLDPRT cube_dimension.swp

that demonstrate some aspects of our problem  (of course the line

    Part.ShowNamedView2 "*Right", 4.

is added in the Macro on purpose)


Thank you very much in advance

Dr. Markus Greger