Precision in input to Solidworks API macro
Precision in input to Solidworks API macro
(OP)
Hi All,
I am trying to use Solidworks API to make a model which uses dimensions down on the micron level.
The problem I am having is reading in small values to the CreateArc2 and CreateLine2 functions.
this is an example of one such line:
Part.CreateArc2 LineInputArray(2), LineInputArray(3), 0, LineInputArray(4), LineInputArray(5), 0, LineInputArray(6), LineInputArray(7), 0, 1
I read into LineInputArray from a text file and the numbers go in fine however when the arc is created it rounds off the numbers lower than 100micron to 0.
Is there a way to increase the precision in the function CreateArc2????? (and CreateLine2?)
I have thought about making the whole part larger and scaling afterwards but that had its own problems.
I have changed the precision in the options and can also change the units in the document but it seems to always read from the API in metres.
I would greatly appreciate any help you could give with this.
Many thanks,
macraiga
I am trying to use Solidworks API to make a model which uses dimensions down on the micron level.
The problem I am having is reading in small values to the CreateArc2 and CreateLine2 functions.
this is an example of one such line:
Part.CreateArc2 LineInputArray(2), LineInputArray(3), 0, LineInputArray(4), LineInputArray(5), 0, LineInputArray(6), LineInputArray(7), 0, 1
I read into LineInputArray from a text file and the numbers go in fine however when the arc is created it rounds off the numbers lower than 100micron to 0.
Is there a way to increase the precision in the function CreateArc2????? (and CreateLine2?)
I have thought about making the whole part larger and scaling afterwards but that had its own problems.
I have changed the precision in the options and can also change the units in the document but it seems to always read from the API in metres.
I would greatly appreciate any help you could give with this.
Many thanks,
macraiga






RE: Precision in input to Solidworks API macro
When you use API to create sketch entities, SW doesn't automatically turn off entity and/or grid snapping or automatic relations. You will actually get different results depending on your zoom level. If you zoom out far enough before running your code, more stuff will get "rounded to zero".
Turning SetAddToDB to True turns off the snapping and should get you the result you want. However, be sure to add some error handling to turn it back to False once you get done.
-handleman, CSWP (The new, easy test)