Insubordinate Ordinates - Help with the the API EditOrdinate Function

Has anyone had success with adding an ordinate dimension to a drawing (.SLDDRW) file via the API?

I had the drawing open with "Drawing View1" showing a top view of the model. I manually added some ordinate dimensions to the model in the view. At this point I need an API call to edit the current ordinate dimension set to add a couple more ordinate dimensions. I have to use the API to add ordinate dimensions becuase I have a program that dynamically generates a linear sketch and repeat in the model, and the sketch and repeat needs to be dimensioned in the drawing. So, I tried using the macro recorder in solidworks and it produced some code (see below) for the following steps.

1) Right Click the ordinate dimension 2) Select add to ordinate 3) Select the arc in the linear sketch and repeat that I want to add the ordinate to

BEGIN RECORDED CODE:

Set Part = swApp.ActiveDoc boolstatus = Part.ActivateView("Drawing View1") boolstatus = Part.Extension.SelectByID2("D2@ snipped-for-privacy@GP0156BG2112A.SLDDRW", "DIMENSION", 0.03783915868172, 0.1332166883938, 0, False, 0, Nothing,

0) Part.EditOrdinate Part.ClearSelection2 True boolstatus = Part.Extension.SelectByID2("Point11310@PinGrid_Sketch@GP0156BG2112A-1@Drawing View1", "EXTSKETCHPOINT", -0.0030000000056, 0.0030000000056, 0, False, 0, Nothing, 0) Set Annotation = Part.AddDimension2(0.0674787, 0.14322, 0) Part.ClearSelection2 True Part.SetPickMode End Sub

END CODE

**Note d2 is the "zero" or base dimension for the ordinates

Now, if I delete the ordinate dim that i created while recording the macro, and then run the macro again to recreate the dim, the ordinate does not appear. I set a breakpoint and stepped through the macro. It appears that the editordinate is actually envoking the same functionality as a "Right Click >> Add to Ordinate" in the GUI. I can tell because the cursor changes to the add ordinate icon. However, when the selectbyid2 is called (which actually does selects the feature because it turns green) the ordinate dimension is NOT placed.

I have tried to rebuild/repaint etc. the drwaing after the macro has run to see if rebuilding/redrawing would make the ordinate dim appear. I even saved the drawing and reopened it. No luck.

I am in a pinch and would appreciate any input on the matter.

Thank you in advance,

Matt Hoffman Applications Engineer EDA Inc.

Reply to
DCIProductions
Loading thread data ...

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.