Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
In the code below, I am not able to finish the codes for
oCount_Constraints_Dimensions = ????
oCount_Constraints_Constraints = ???
I need information for the following. I appreciate receiving help. Thank.
I also wish to expand this rule for 3D sketches. I appreciate any help.
Dim oCommandMgr As CommandManager
oCommandMgr = ThisApplication.CommandManager
' Dim and select Sketch1
Dim oSketches As PlanarSketches = ThisApplication.ActiveEditDocument.ComponentDefinition.Sketches
If TypeOf ThisApplication.ActiveEditObject Is Sketch Then
Dim oSketch As Sketch = ThisApplication.ActiveEditObject
oSketch.ExitEdit
End If
oSketches("Sketch1").Edit
' Get control definition for the line command.
Dim oControlDef As ControlDefinition
' Get control definition for the line command.
oControlDef = oCommandMgr.ControlDefinitions.Item("SketchAutoDimensionCmd")
oCount_Constraints_Dimensions= 1 '1 is wrong. Need to fix code
oCount_Constraints_Constraints = 1 '1 is wrong. Need to fix code
oYN = MessageBox.Show("Missing dimensions: " & oCount_Constraints_Dimensions _
& vbLf & "Missing constraints: " & oCount_Constraints_Constraints, _
"Do you want to add dimensions automatically?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)
If oYN = vbYes Then
Call oControlDef.Execute
'Press Apply button
Dim oKCmd As ControlDefinition
oKCmd = ThisApplication.CommandManager.ControlDefinitions.Item("AppContextual_OKCmd")
Call oKCmd.Execute
Else
MessageBox.Show("Message", "Title")
'Code to add dimensions
End If
oSketches("Sketch1").ExitEdit
Solved! Go to Solution.