Vba Matchcrop rule

Vba Matchcrop rule

Anonymous
Not applicable
313 Views
2 Replies
Message 1 of 3

Vba Matchcrop rule

Anonymous
Not applicable

This Vba code works great with line MsgBox ("Matchcrop") but if i remove the line the code doesn't work.

Can anyone help with this??

 

Sub MatchCrop_MA()
On Error Resume Next
Dim odoc As Document
Set odoc = ThisApplication.ActiveDocument
oSelectedPriority = odoc.SelectionPriority
odoc.SelectionPriority = kEdgeSelectionPriority
odoc.Update2 (True)
MsgBox ("Matchcrop")
ThisApplication.CommandManager.ControlDefinitions.Item("AppRefreshCmd").Execute2 (True)
Set oitem1 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllEntitiesFilter, "Select first line")
If oitem1 Is Nothing Then
odoc.SelectionPriority = oSelectedPriority
Exit Sub
End If

again:
Set oitem2 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllEntitiesFilter, "Select second line")
If oitem2 Is Nothing Then
odoc.SelectionPriority = oSelectedPriority
Exit Sub
End If

oitem2.Layer = oitem1.Layer
GoTo again
End Sub

 

0 Likes
314 Views
2 Replies
Replies (2)
Message 2 of 3

tobias.orlow
Alumni
Alumni

Hi vulic,

 

The code works as expected on my side, also without the MessageBox. What exactly is not working on your side if you remove the MessageBox?

Which version of Inventor are you working on?

 

Many thanks,
Tobias

Tobias Orlow
Designated Support Specialist
Customer Success Organization
Linkedin: www.linkedin.com/in/tobiasorlow/
0 Likes
Message 3 of 3

Anonymous
Not applicable

My firm stayed at Autodesk® Inventor® 2018

0 Likes