I have a sketch block definition that contains a circle. The center of the circle is the origin for a coordinate system. At runtime, I will add lines to the block sketch where needed.

 

My question is: What are the units of the values returned by ISketchBlockDefinition::GetArcs?

 

The document units are Inch-Pound-Second.

 

While editing the block definition via the user interface, the center of the circle is at 0.0, 0.70866.

 

While editing via the API, the center of the circle is at 0.0, 0.01799996.

 

Now, 0.70866 is 17.99996 mm, or 0.01799996 meter.

 

So it seems that the units of the values returned by GetArcs are meters.

 

I'm wondering if this is immutable: Will the units of the values returned by GetArcs always be meters?

 

 

By the way, because it took me a while to figure out what to do, and because I did not see an example elsewhere in this forum, I will mention that I selected the feature attached to the sketch block definition immediately prior to calling SketchManager.EditSketchBlock. Someone else may find this in a search.

 

Here is the VB.Net code:

oDrawingModel = oSwApp.ActiveDoc
oSketchManager = oDrawingModel.SketchManager
oSelectionMgr = oDrawingModel.SelectionManager
oSelectData = oSelectionMgr.CreateSelectData
oDrawingModel.ClearSelection2(True)

 

oFeature = oDatamatrixBlockDefinition.GetFeature
oFeature.Select2(False, 0)
oSketchManager.EditSketchBlock()

Categories: API∕Macros

Comments
Last comment By: Greg Ashmore   Wed, 15 Nov 2017 12:30:19 GMT
Re: Units of values returned by ISketchBlockDefinition::GetArcs

Yes.  Always meters.  Most values you get from API functions are in system units, which are always meters regardless of document settings.

By: Josh Brady  Tue, 14 Nov 2017 19:17:56 GMT
Re: Units of values returned by ISketchBlockDefinition::GetArcs

Thanks. Makes sense.

By: Greg Ashmore  Tue, 14 Nov 2017 19:32:14 GMT
Re: Units of values returned by ISketchBlockDefinition::GetArcs

Confirmed by SolidWorks Tech Support:

 

 

As per documentation here(http://help.solidworks.com/2018/english/api/sldworksapiprogguide/overview/units.htm)  SW API uses metric units. Specifically, the SOLIDWORKS API accepts or returns values as meters, radians, kilograms, square meters, or cubic meters.

By: Greg Ashmore  Wed, 15 Nov 2017 12:30:19 GMT
You are not authorized to view this page No results found! Suggestions: Check spelling, try a different search, or browse topics below.