Hello,
According to the API Help, ISketchManager::CreateCornerRectangle returns "Array of sketch segments that represent the edges created for this corner rectangle." So you would think you could declare a sketch segment variable and then set this function equal to it, as I have below:
'Precondition: part document is open
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
'insert sketch on front plane
swModel.Extension.SelectByID2 "Front Plane", "PLANE", 0, 0, 0, False, 0, Nothing, 0
swModel.SketchManager.InsertSketch True
'change settings
swModel.SketchManager.AddToDB = True
swApp.SetUserPreferenceToggle swInputDimValOnCreate, False
'create corner rectangle
Dim skSeg As SldWorks.SketchSegment
Set skSeg = swModel.SketchManager.CreateCornerRectangle(0, 0, 0, 0.01, 0.01, 0)
'exit sketch
swModel.SketchManager.InsertSketch True
'revert settings
swModel.SketchManager.AddToDB = True
swApp.SetUserPreferenceToggle swInputDimValOncreate, True
End Sub
This actually creates the rectangle and yet on the line of that CreateCornerRectangle method I also get "Object required". So I looked at an example with this CreateCornerRectangle function and in the example given they actually declare a variant and then set the function equal to that. I tried it here but still no luck.
I would appreciate any help.
SolidworksApi macros