How to constrain two sketch circles

I am trying to fully constrain to circles. I used following constraints

cir and cir1 are two circle objects.

1)          Dim selCenter(1) As Object
              Set selCenter(0) = cir.GetCenterPoint2
              Set selCenter(1) = cir1.GetCenterPoint2
           
              mySketch.RelationManager.AddRelation selCenter, swConstraintType_HORIZPOINTS
             
2)        Dim selCenter1(1) As Object
            Set selCenter1(0) = cir1
            Set selCenter1(1) = cir
           
            mySketch.RelationManager.AddRelation selCenter1, swConstraintType_SAMELENGTH

Now I need to define 'distance between two circle's center points' to make them fully constraint. Please tell me how to do it.

I tried swConstraintType_DISTANCE 1
swConstraintType_DOUBLEDISTANCE 41

but it doesn't define distance constraint. Can you please guide how to do the same.

Thanks in advance,

SolidworksApi macros
Answers 4
ST
ST 2013-11-19 Best Answer

You must add a dimension to constrain the distance

SF
SF 2013-11-19

But if I add dimension using API then it pop ups dimension UI and it irritates when I am loop of 100 circles. Is there any alternate way to hide or suppress or skip UI? I dont want to see dimensions also.

What is the alternative??

ST
ST 2013-11-19

swApp.SetUserPreferenceToggle(swUserPreferenceToggle_e.swInputDimValOnCreate, False)

will stop that popup.

MM
MM 2013-11-19

Like Simon said turn the user preference off. But make sure you turn it back on if you would normally have it on.