几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   SolidWorks二次开发 (http://www.dimcax.com/hust/forumdisplay.php?f=111)
-   -   【转帖】run once (http://www.dimcax.com/hust/showthread.php?t=5692)

yang686526 2009-04-13 02:00 PM

【转帖】run once
 
run once
hi
please advise if it is possible for a macro to be run once only.the attached macro scales the part by enlargening it by 1%.the scale function is renamed to shrinkage0.1 in the tree.is it possible for the macro to check the tree first if "shrinkage0.1 is already there? if "shrinkage0.1" is in the tree then could some code be added to say that the macro has been run already by means of a msgbox.
thank you
feroz mahomed
windows xp professional sp2
sworks 2009 sp2
nvidia quadro fx1500
hi feroz,
you coud use featuremanager::isnameused to know if the feature already exist.
simone
simone,
thank you for the response. do you have an example of how i could do this? please note that i don't have any programming experience.
feroz mahomed
windows xp professional sp2
sworks 2009 sp2
nvidia quadro fx1500
hi feroz,
i don't have any example, anyway it's very simple:
- get the feature manager object by the document modeldoc2::featuremanager
- call the method featuremanager::isnameused that returns true if already exist a feature with the name searched.
i don't know your situation, anyway you can retrive the document object (modeldoc2) by many ways: from solidworks by activedoc, from a component, ecc...
simone
simone,
as stated previously, i don't have any vb programming knowledge.i usually modify example simple api files to suit my needs.
feroz mahomed
windows xp professional sp2
sworks 2009 sp2
nvidia quadro fx1500
quick


所有的时间均为北京时间。 现在的时间是 11:00 AM.