Question about blocks

Discussion in 'SolidWorks' started by Nathan Feculak, Dec 23, 2003.

  1. I have a block created with gear data in it and I have two dimensions with
    tolerances in it these tolarances are bilateral tolerances how can I put in
    these tolerances. I currently have a note on a note but it is realy hard to
    update the tolerances note without moving the underlaing note. is this the
    only way to do this?

    Thanks Nathan
     
    Nathan Feculak, Dec 23, 2003
    #1
  2. You could name the notes and Edit them using a simple Macro.
    This is the sub I use to update the fields in a block that I created for
    Revisions.

    Public Sub UpdateBlock(BlockName As SldWorks.BlockInstance)

    BlockName.SetAttributeValue "TOP DESC", RevisionForm.Description1.Text
    BlockName.SetAttributeValue "TOP DATE", RevisionForm.Date1.Text
    BlockName.SetAttributeValue "MID DESC", RevisionForm.Description2.Text
    BlockName.SetAttributeValue "MID DATE", RevisionForm.Date2.Text
    BlockName.SetAttributeValue "BOT DESC", RevisionForm.Description3.Text
    BlockName.SetAttributeValue "BOT DATE", RevisionForm.Date3.Text

    End Sub

    Also use this to rename the note objects so you can edit them using Update
    Block

    Function SetNoteName(NewName As String)

    Dim MyNote As SldWorks.note
    Dim FoundMyNote As Boolean
    Dim SelMgr As SldWorks.SelectionMgr
    Dim LPCALLOUT As Callout
    Dim userName As String


    Set swApp = Application.SldWorks
    Set part = swApp.ActiveDoc
    Set Part1 = part.Extension


    ' Get the selection manager class

    Set SelMgr = part.SelectionManager()


    ' If user has selected something

    If (SelMgr.GetSelectedObjectCount <> 0) Then

    ' Get the first item in the selection list

    Set MyNote = SelMgr.GetSelectedObject2(1)

    ' If selected object is a note

    If (SelMgr.GetSelectedObjectType(1) = 15) Then


    ' Change the name of the note

    ret = MyNote.SetName(NewName)


    ' End if selected object was note or not

    End If

    Else
    MsgBox "There is nothing selected"
    End
    ' End if there is an object selected

    End If

    End Function

    Hope this helps

    Corey Scheich
     
    Corey Scheich, Jan 5, 2004
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.