Help - dimensioning a sketched line in a drawing view

Sketched a line in a drawing view:
Dim swLine1 As SketchSegment
Set swLine1 = swDraw.CreateLine2(sngLft, sngTop, 0, sngRght, sngTop, 0)
Trying to dimension it now:
blnRetVal = swLine1.Select4(True, swSelData)
Set swDim = swDraw.AddDimension2(sngXText, sngYTxt, 0)
When I hit the swDraw.AddDimension2 line, everything just locks up.
What am I doing wrong here?
Thanxs -
Reply to
What-a-Tool
Loading thread data ...
I'll give this one a shot, although I'm not exactly an api knowlegeable person.
Looks as though you are setting the annotation position but failing to give it a value. The test macro that I ran sets this by a line following your second dimensioning line by one that looks like this: Part.Parameter("D1@Sketch1").SystemValue = 0.0379683 the api might be hanging because its waiting for the value. Do remember that the api runs in meters and may need conversion.
Reply to
Brian
This selects the line I just created: blnRetVal = swLine1.Select4(True, swSelData)
This dimensions the selected object (The only reference required is that the object you want dimensioned is selected.): Set swDim = swDraw.AddDimension2(sngXText, sngYTxt, 0)
What I am doing is determining the size of my part as my drawing is created, and drawing a boundind box around my part in each seperate view, in a seperate layer. I am then dimensioning the 3 axis' of this bounding box, also on this hidden layer.
My problem (just discovered) : I was running SW invisibly, and when my dimension was created, the dimension's approve/change dialog box was not visible, and my code coudn't progress until I did something about this dialog I couldn't see.
What I want is to create a driven dimension, so I won't have to deal with this dialog. I can't find anything in the API for doing this. Changing the driven state of an already created dimension, yes - creating as driven, No. I can create a non-associated dimension, but thats not really what I want.
Can anyone give me a pointer in the right direction (creating a driven dimension)?
By the way - thanks for the reply, Brian
Reply to
What-a-Tool
Try this maybe. Tools-system options-general-clear the "input dimension value" checkbox and the sketch-"prompt to set driven state" box also. The macro should then funtion (eliminates the spin box from the dimensioning process). That will create driving dimensions for those lines that are not fully defined and driven for those that are. If that is not what you are after then you can toggle the system preferences values from within a macro and back again once the dimensioning is done. Can also toggle the state of the dimension from driving to driven if, for some reason, you wanted to leave them as driven. I don't see a way to create a driven dimension directly if the object is not fully defined already. Seems as though you have to create it as a driving then toggle its state.
Brian Hokanson Starting Line Products
Reply to
Brian

Site Timeline

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.