Hello,
I try to write macro and I have few problems.
First of these is when I draw a rectangle(vSkLines = CType(swDoc.SketchManager.CreateCornerRectangle(-101.7/ 1000, 0.0, 0.0, -98.3 / 1000, -2 / 1000, 0), Array)) in a sketch, add the curve through the x y z points and Sweep it with direction vector. And when I’m editing operation in SolidWorks there is no direction vector there.
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.
Thank you for all help.
Paul.
SolidworksApi macros
For the second issue try to set the SketchManager::AddToDb property to ‘true’ before inserting the sketch rectangle. Do not forget to restore this property value after finish.
The first issue is not clear to me – could you please clarify?
____________________________________________________
Regards,
Artem Taturevych, Application Engineer at Intercad (Australia)
translationXpert – add-in to translate SolidWorks models
myIntercad – an integrated tool for SolidWorks Professionals
LinkedIn SolidWorks API Education Group
Thanks Artem for your answer, but unfortunately It doesn’t help.
The second 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)
As You can see ther 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.
Regards Paul.