×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Scale in Note.

Scale in Note.

Scale in Note.

(OP)
How do we include the scale of a view in a note on a draaawing (linked)?
SW2005 sp0.

RE: Scale in Note.

(OP)
No thats not it, thread559-155291
Thats basically the standard SW help.
When you have a standard view (not detail etc).
We put multiple parts on one sheet & sometimes scale them differently, how can we show the scale for each part on the drawing in a note:
We have good reasons to do this.

RE: Scale in Note.

tighthead,

Here is some code I wrote awhile back that may help you.

Regards,

Regg

CODE

Option Explicit

Dim swApp As SldWorks.SldWorks
Dim swModelDoc As SldWorks.ModelDoc2
Dim swDrawing As SldWorks.DrawingDoc
Dim swSelMgr As SldWorks.SelectionMgr
Dim swView As SldWorks.View
Dim swNote As SldWorks.note
Dim swAnnotation As SldWorks.Annotation
Dim swSelection() As Object

Dim ScaleRatio As Variant
Dim ViewCorners As Variant
Dim SelectionIndex As Long

Sub main()

    'attach to SolidWorks
    Set swApp = Application.SldWorks
    
    'get active document
    Set swModelDoc = swApp.ActiveDoc
    
    'check for document
    If swModelDoc Is Nothing Then
    
        MsgBox "No active document.     ", vbOKOnly + vbCritical, "Label View Scale"
        Exit Sub
        
    End If
    
    'check if document is drawing
    If swModelDoc.GetType = swDocDRAWING Then
    
        Set swDrawing = swModelDoc
        
    Else
    
        MsgBox "Active document must be drawing.    ", vbOKOnly + vbCritical, "Label View Scale"
        Exit Sub
        
    End If
    
    'get selection manager
    Set swSelMgr = swModelDoc.SelectionManager
    
    'check if anything selected
    If swSelMgr.GetSelectedObjectCount = 0 Then
    
        MsgBox "No views selected.    ", vbOKOnly + vbCritical, "Label View Scale"
        Exit Sub
        
    Else
    
        'save selections
        ReDim swSelection(1 To swSelMgr.GetSelectedObjectCount) As Object
    
        'check if selection is drawing view
        For SelectionIndex = 1 To swSelMgr.GetSelectedObjectCount
        
            If swSelMgr.GetSelectedObjectType2(SelectionIndex) = swSelDRAWINGVIEWS Then
            
                Set swSelection(SelectionIndex) = swSelMgr.GetSelectedObject5(SelectionIndex)
                
            End If
            
        Next

    End If
    
    'analize selections
    For SelectionIndex = 1 To swSelMgr.GetSelectedObjectCount
    
        'check if selected object is view
        If swSelection(SelectionIndex) Is Nothing Then
        
            MsgBox "Selected object " & SelectionIndex & " is not a drawing view.     ", vbOKOnly + vbExclamation, "Label View Scale"
            
        Else
        
            'get selected view
            Set swView = swSelection(SelectionIndex)
            
            'get view scale
            ScaleRatio = swView.ScaleRatio
            
            'get view corner locations
            ViewCorners = swView.GetOutline
                
            'lock view focus so note will move if corresponding view moved
            swView.FocusLocked = True
            
            'create note
            Set swNote = swDrawing.InsertNote("Scale " & ScaleRatio(0) & ":" & ScaleRatio(1))
            
            'set note angle
            swNote.angle = 0
            
            'set note is balloon to no
            swNote.SetBalloon 0, 0
            
            'get note annotation object
            Set swAnnotation = swNote.GetAnnotation
            
            'set note leader to none
            swAnnotation.SetLeader2 False, 0, True, False, False, False
            
            'locate note 10mm right from left edge and 5mm below from bottom edge of view bounding box
            swAnnotation.SetPosition ViewCorners(0) + 0.01, ViewCorners(1) - 0.005, 0
            
            'unlock  view focus
            swView.FocusLocked = False
            
        End If
        
    Next
            
    'refresh graphics screen
    swModelDoc.WindowRedraw
    
End Sub

RE: Scale in Note.

I apoligize for my misunderstanding of your post.  There is one possibility to make a linked note, but it's sort of hoky, and you may not want to do it.  You would have to make each view either a detail view or auxiliary view of a view that's off the sheet printable area.  You would also have to manually line up the different views of each part.  Go to Tools->Options->Document Properties->Detailing->View Labels and change the view label format to show only the scale.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources