![]() |
1-354247171 - Automating cylinder creation in SW API
ear Daniel,
Thank you for contacting SolidWorks API Support. Please look at the method "AssemblyDoc::InsertNewPart2". Attached is a macro which I have recorded to perform the cylinder creation operation in the assembly. In the macro, please put the path and filename for the new part in the "InsertNewPart2" method. I hope this helps. Regards, Pabitra Pabitra Behera | API Support www.solidworks.com | www.solidworks.com/api Date Opened : 9/13/2006 05:18:46 AM Summary : Automating cylinder creation in SW API Description : Hi, Is there a simply set of commands I can use to automate the creation of a cylinder in an assembly? I am using VB 6. Thanks. Daniel Brown Robotics Engineer Accuray, Inc. ACCURAY: Enabling full-body radiosurgery using image-guided robotics 1310 Chesapeake Terrace Sunnyvale, CA 94089 408-716-4600 x4830 (Office) |
回复: 1-354247171 - Automating cylinder creation in SW API
Hi Pabi,
Thanks for your recent help on automating the creation of cylinders in SW. I have another question in connection with the same project I'm working on. Basically, I'm trying to generate a number (as much as 150 in some cases) of cylinders and insert them into an assembly, which in turn is inserted into another assembly. The problem is that Sw complains that it runs out of memory space at around the 30th cylinder even though I close all the cylinder part files. Is there a way I can turn off something (may be auto saving or whatever) that can solve the problem? I must be able to insert all 150 *for instance) into the assembly in one move. I am attaching a sample file fyi. <<Trigem_G4_M_Path3.SLDPRT>> Thanks in advance for your help Daniel Brown |
回复: 1-354247171 - Automating cylinder creation in SW API
Hello Daniel,
Make sure to destroy all the object created inside the loop before you go to process the next. As an example in VB: Set swFeature = Nothing Set swSketch = Nothing etc. This will help in releasing the memory. Also you can use DoEvents function. Use this in between the major operation like Opendoc, ForceRebuild, Or Save etc.(Please refer to the DoEvents in MSDN for better understanding) I hope this helps. Regards, Pabitra |
回复: 1-354247171 - Automating cylinder creation in SW API
Hi Pabi,
I tried all the suggestion you gave but I'm running into the same problem. Will it make a difference if I suppressed on the previously inserted cylinders before attempting to create and insert another one? Thanks Daniel Brown |
回复: 1-354247171 - Automating cylinder creation in SW API
Hi Daniel,
Definitely it will make a difference. A suppressed component is removed from memory, so loading speed, rebuild speed, and display performances are improved. Because of the reduced complexity, evaluation of remaining components occurs faster. Also, you should look into “Work with Lightweight Components” (see API help file). Regards, Pabitra |
所有的时间均为北京时间。 现在的时间是 02:04 AM. |