AnsweredAssumed Answered

How do I "Break Alignment" of selected ordinate dimensions with a macro?

Question asked by Chad Kingston on Mar 13, 2020
Latest reply on Mar 16, 2020 by Mike Spens

This may sound lazy, but I'm tired of right-clicking and visually finding "Break Alignment" any time I want to break the alignment of an ordinate dimension (I do this 20+ times per day). I've tried to record a macro doing this and it created the code below. The problem with this code is it will only work with this specific drawing, view, and dimensions. I need to be able to populate the SelectByID2 with variables based off of my dimension selection. I've tried messing with different API commands like GetDimensionInfo, but haven't been able to get it to work. If there is an easier way, that would be great, but so far, I need to get the dimension primary value eg. "D11@Sketch4 (Part #)" and the dimension coordinates for each dimension.

 

Dim swApp As Object

Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long

Sub main()

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc
boolstatus = Part.ActivateView("Drawing View1")
boolstatus = Part.Extension.SelectByID2("D11@Sketch4@GUARD - GANGNAM LVO FAN.SLDDRW", "DIMENSION", 0.230096953292824, 0.193276868493506, 0, True, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("D2@Sketch4@GUARD - GANGNAM LVO FAN.SLDDRW", "DIMENSION", 0.220575644880263, 0.191567915701508, 0, True, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("D4@Sketch4@GUARD - GANGNAM LVO FAN.SLDDRW", "DIMENSION", 8.58125104255456E-02, 0.195962365738075, 0, True, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("D5@Sketch4@GUARD - GANGNAM LVO FAN.SLDDRW", "DIMENSION", 8.38594215204048E-02, 0.19547409351179, 0, True, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("D5@Sketch4@GUARD - GANGNAM LVO FAN.SLDDRW", "DIMENSION", 8.38594215204048E-02, 0.19547409351179, 0, False, 0, Nothing, 0)

Part.BreakDimensionAlignment

End Sub

Outcomes