Calculate distance between points in differents sketches SolidWorks API -



have been working on script application solidworks since month , half , make better since pretty slow.

what script :
1. tell user select specific component (using advanced select).
2. make collection out of components.
3. make collection out of collection because need them regroup depending of configuration.
4. in every component sketch single sketchpoint. have calculate distance between point , origin of predetermine point in 3d sketch. bring sketchpoint attach component 3dsketch, calculate, delete it.
5. every component (60++)

the time consuming part 1 have edit 3dsketch, bring 1 point it, close edition, calculate distance, edit, delete, close again.

i doing more oriented object approach no more collection of collection, still problem stay. wondering if imath useful since i've seen : http://help.solidworks.com/2014/english/api/sldworksapi/transform_sketch_to_model_example_vb.htm
seems work properly.

ah , aware of measure tool won't work since need negative value if sketchpoint "behind" origin.

thank :)

well have asked same question on solidworks forum , 1 gave me answer, here :

dim mycomp component2 dim fsketch feature dim swsketch sketch dim vsketchpts variant dim swsketchpt sketchpoint dim p(2) double dim mpt mathpoint dim vpt variant dim myutil mathutility  set myutil = swapp.getmathutility set fsketch = mycomp.featurebyname("mysketchname") set swsketch = fsketch.getspecificfeature2 vsketchpts = swsketch.getsketchpoints2 set swsketchpt = vsketchpts(0)  p(0)=swsketchpt.x p(1)=swsketchpt.y p(2)=0.0 vpt = p set mpt = myutil.createpoint(vpt)   dim mthtrans mathtransform  set mthtrans = swsketch.modeltosketchtransform set mpt= mpt.multiplytransform(mthtrans.inverse) set mthtrans = swirboxcomp.transform2 set mpt= mpt.multiplytransform(mthtrans) vpt = mpt.arraydata ' contain xyz coordinates of point in coordinate system of 3d sketch 

all credits go simon turner https://forum.solidworks.com/people/1-kqhm1


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -