AnsweredAssumed Answered

How can I get the correct orientation for sketches in some macro commands on some PC's running SW2017?

Question asked by Adam Kaplan on Oct 13, 2017
Latest reply on Oct 16, 2017 by Jacob Corder

Hello all,

 

We have an SWB macro, has always worked well for many years. In SW2017, we started having an issue on a particular computer with the orientation of the sketches.

 

The macro produces a hub, lofted using 9 sketches. When the macro executes properly, we get a hub:

ProperResults.png

 

In SW2017, on this particular computer, the orientation the sketch changes throughout the macro and causes the loft to fail:

FailResults.jpgFail2Results.png

 

The macro for the hub only is provided below for your review:

----------------------------------------------------------------------------------------------------

' **********

' blade surface macro built by HydroComp PropCad 16.04.0029

' 2016/12/19-13:40

' for SolidWorks 2010+

' all data in meters

' **********

Const swDisplayTemporaryAxes = 7

Dim swApp as Object

Dim Part as Object

Dim boolstatus as Boolean

Dim CreatedPlane(0 To 8) as String

Sub main()

    Call Hub()

End sub

' **********

' hub envelope macro built by HydroComp PropCad 16.04.0029

' 2016/12/19-13:40

' for SolidWorks 2010+

' all data in meters

' **********

Sub Hub()

Set swApp = Application.SldWorks

Set Part = swApp.NewPart

Dim RefPlane As String

Dim blnDispGrid As Boolean

Dim dblGridSpacing As Double

Dim blnSnap As Boolean

Dim blnDotStyle As Boolean

Dim dblMajor As Double

Dim dblMinor As Double

Dim blnAlign2Edge As Boolean

Dim blnAngleSnap As Boolean

Dim dblAngleUnit As Double

Dim blnMinorAuto As Boolean

blnAlign2Edge = False

RefPlane = "Right Plane"

CreatedPlane(0) =  "Plane1"

CreatedPlane(1) =  "Plane2"

CreatedPlane(2) =  "Plane3"

CreatedPlane(3) =  "Plane4"

CreatedPlane(4) =  "Plane5"

CreatedPlane(5) =  "Plane6"

CreatedPlane(6) =  "Plane7"

CreatedPlane(7) =  "Plane8"

CreatedPlane(8) =  "Plane9"

Part.GridOptions False, 0, False, False, 0, 0, False, False, 0, False

Part.SelectByID RefPlane, "PLANE", 0, 0, 0

Part.CreatePlaneAtOffset 0.0762, 1

Part.SelectByID RefPlane, "PLANE", 0, 0, 0

Part.CreatePlaneAtOffset 0.05953125, 1

Part.SelectByID RefPlane, "PLANE", 0, 0, 0

Part.CreatePlaneAtOffset 0.0428625, 1

Part.SelectByID RefPlane, "PLANE", 0, 0, 0

Part.CreatePlaneAtOffset 0.02619375, 1

Part.SelectByID RefPlane, "PLANE", 0, 0, 0

Part.CreatePlaneAtOffset 0.009525, 1

Part.SelectByID RefPlane, "PLANE", 0, 0, 0

Part.CreatePlaneAtOffset 0.00714375, 0

Part.SelectByID RefPlane, "PLANE", 0, 0, 0

Part.CreatePlaneAtOffset 0.0238125, 0

Part.SelectByID RefPlane, "PLANE", 0, 0, 0

Part.CreatePlaneAtOffset 0.04048125, 0

Part.SelectByID RefPlane, "PLANE", 0, 0, 0

Part.CreatePlaneAtOffset 0.05715, 0

Part.ClearSelection

Part.SelectByID CreatedPlane(0),"PLANE",0, 0, 0

Part.InsertSketch

Part.CreateCircle 0, 0, 0, 0, 0.048006, 0

Part.InsertSketch

Part.SetAddToDB (True)

Part.ClearSelection

Part.SelectByID CreatedPlane(1),"PLANE",0, 0, 0

Part.InsertSketch

Part.CreateCircle 0, 0, 0, 0, 0.04763542, 0

Part.InsertSketch

Part.SetAddToDB (True)

Part.ClearSelection

Part.SelectByID CreatedPlane(2),"PLANE",0, 0, 0

Part.InsertSketch

Part.CreateCircle 0, 0, 0, 0, 0.04718447, 0

Part.InsertSketch

Part.SetAddToDB (True)

Part.ClearSelection

Part.SelectByID CreatedPlane(3),"PLANE",0, 0, 0

Part.InsertSketch

Part.CreateCircle 0, 0, 0, 0, 0.04657279, 0

Part.InsertSketch

Part.SetAddToDB (True)

Part.ClearSelection

Part.SelectByID CreatedPlane(4),"PLANE",0, 0, 0

Part.InsertSketch

Part.CreateCircle 0, 0, 0, 0, 0.04572, 0

Part.InsertSketch

Part.SetAddToDB (True)

Part.ClearSelection

Part.SelectByID CreatedPlane(5),"PLANE",0, 0, 0

Part.InsertSketch

Part.CreateCircle 0, 0, 0, 0, 0.04457254, 0

Part.InsertSketch

Part.SetAddToDB (True)

Part.ClearSelection

Part.SelectByID CreatedPlane(6),"PLANE",0, 0, 0

Part.InsertSketch

Part.CreateCircle 0, 0, 0, 0, 0.04318397, 0

Part.InsertSketch

Part.SetAddToDB (True)

Part.ClearSelection

Part.SelectByID CreatedPlane(7),"PLANE",0, 0, 0

Part.InsertSketch

Part.CreateCircle 0, 0, 0, 0, 0.04163467, 0

Part.InsertSketch

Part.SetAddToDB (True)

Part.ClearSelection

Part.SelectByID CreatedPlane(8),"PLANE",0, 0, 0

Part.InsertSketch

Part.CreateCircle 0, 0, 0, 0, 0.040005, 0

Part.InsertSketch

Part.SetAddToDB (True)

Part.ClearSelection

Part.SelectByID CreatedPlane(0), "PLANE", 0, 0, 0

Part.InsertSketch

Part.CreateCircle 0, 0, 0, 0, 0.022225, 0

Part.InsertSketch

Part.ClearSelection

Part.SelectByID CreatedPlane(8), "PLANE", 0, 0, 0

Part.InsertSketch

Part.CreateCircle 0, 0, 0, 0, 0.01805781, 0

Part.InsertSketch

Part.ClearSelection

Part.SelectByMark "Sketch1", "SKETCH", 0.048006, 0, 0, 1

Part.AndSelectByMark "Sketch2", "SKETCH", 0.04763542, 0, 0, 1

Part.AndSelectByMark "Sketch3", "SKETCH", 0.04718447, 0, 0, 1

Part.AndSelectByMark "Sketch4", "SKETCH", 0.04657279, 0, 0, 1

Part.AndSelectByMark "Sketch5", "SKETCH", 0.04572, 0, 0, 1

Part.AndSelectByMark "Sketch6", "SKETCH", 0.04457254, 0, 0, 1

Part.AndSelectByMark "Sketch7", "SKETCH", 0.04318397, 0, 0, 1

Part.AndSelectByMark "Sketch8", "SKETCH", 0.04163467, 0, 0, 1

Part.AndSelectByMark "Sketch9", "SKETCH", 0.040005, 0, 0, 1

Part.InsertProtrusionBlend2 False, False, True

Part.ClearSelection

Part.SelectByMark "Sketch10", "SKETCH", 0.022225, 0, 0, 1

Part.AndSelectByMark "Sketch11", "SKETCH", 0.01805781, 0, 0, 1

Part.FeatureManager.InsertCutBlend 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1

End Sub

----------------------------------------------------------------------------------------------------

 


If you have any ideas, I'd love some help...

-Adam

Attachments

Outcomes