Message 1 of 7

Not applicable
11-21-2016
01:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I was kindly given this code below by another user. The code is in a part file and is triggered by an 'form' when you insert the part into an assemble.
The assembly default selection filter is "Component priority" but I need it to be "Select faces and edges" while I pre select the edge befo
re running the rule. After I have run the rule I want the selection filter to revert back to "Component priority"
Format:HTML Format Version:1.0 StartHTML: 165 EndHTML: 10155 StartFragment: 314 EndFragment: 10123 StartSelection: 314 EndSelection: 314SyntaxEditor Code Snippet
Sub Dim_Length Dim oApp As Application oApp = ThisApplication Dim oDoc As Document oDoc = oApp.ActiveDocument ' Get selection set Dim oSelSet As SelectSet oSelSet = oDoc.SelectSet ' If no objects are selected, then exit If oSelSet.Count = 0 Then MsgBox("You must pre select a line before running this rule",vbOKOnly, "Warning") Exit Sub End If Dim oEdge As Object ' Get Edge or EdgeProxy object (Edge for part environment and EdgeProxy for assembly environment) oEdge = oSelSet.Item(1) ' If selected object is not of type Edge or EdgeProxy then exit If (Not TypeOf oEdge Is Edge) And (Not TypeOf oEdge Is EdgeProxy) Then Exit Sub End If ' Get length between endpoints of edge [cm] Dim dLength As Double dLength = oApp.MeasureTools.GetMinimumDistance(oEdge.StartVertex, oEdge.StopVertex)*10 ' Display length of line MsgBox(dLength & " mm",vbOKOnly, "Length dim") End Sub
This is beyond my skill level so any help would be appriecated
thanks
M
Solved! Go to Solution.