Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

SolidWorks macro problems

Quordis

New member
Hello,
I try to write macro and I have few problems.

First problem is about this part of code:

boolstatus = swDoc.Extension.SelectByID2("Szkic1", "SKETCH", -0.103609986623, 0, 0, False, 1, Nothing, 0)
boolstatus = swDoc.Extension.SelectByID2("Krzywa1", "REFERENCECURVES", 0.03897789893665, -0.01380502702305, 0.1061164316121, True, 4, Nothing, 0)
boolstatus = swDoc.Extension.SelectByID2("Line1@Szkic2", "EXTSKETCHSEGMENT", 0, -0.007471267454362, 0, True, 128, Nothing, 0)
Dim myFeature As Feature = Nothing
myFeature = CType(swDoc.FeatureManager.InsertProtrusionSwept3(False, False, 0, False, False, 0, 0, False, 0, 0, 0, 2, True, True, True, 0, True), Feature)

There is selected profile and sweep path, and the third is direction vector. When I run macro SolidWorks make this sweep without this vector. I check it in the API, but everything seems to be correct. The profile has mark 1, the sweep path 4. PathAlign in InsertProtrusionSwept3 function is set to 2 and TtwistCtrlOption is set to 0.


The second problem that I have is when I make second sketch on the same plan as before and make rectangle(vSkLines = CType(swDoc.SketchManager.CreateCornerRectangle(-101.7 / 1000, -0.3 / 1000, 0, -91.7 / 1000, -3.3 / 1000, 0), Array)) which should be -0.3 on Y axis. When I look in SolidWorks both of rectangle have Y =0.

I Was Looking in API help and on many forums, and I can’t fix it.
I attach my macro, and hope that this can be solved.
Macro.zip - download. Darmowy hosting plików.

Thank You for all help.
Regards Paul.
 

Sponsor

Articles From 3DCAD World

Back
Top