AutoFilling title Blocks

Discussion in 'SolidWorks' started by Chris Tellers, May 31, 2004.

  1. I often create many drawing sheets for each mold I design. I would
    like to be able to fill in one title block and click a button to fill
    in the rest of the title blocks automatically. In autocad I have a
    lisp routine that updates the same attributes in each title block. I
    thought maybe someone had made an API program that did something
    similiar.

    Thanks in advance
    Chris
     
    Chris Tellers, May 31, 2004
    #1
  2. Chris Tellers

    Dave H Guest

    Use custom properties in the model and link them to the fields in the
    border title block. Look this up in help.

    Dave H
     
    Dave H, May 31, 2004
    #2
  3. ....and you propably want something like SWit to save the properties to
    the model: www.markkulehtola.net/swit.html
     
    Markku Lehtola, May 31, 2004
    #3
  4. Are you using the custom properties from your model file to fill the title
    block automatically?
     
    Rob Rodriguez, May 31, 2004
    #4
  5. The problem with using custom properties is that I often will have
    more than one component for the mold on the same sheet. Also, I would
    have to fill in all of the same info for each component of the mold.
    I would rather just fill in one title block then run a macro or
    something to fill in the rest of the title blocks. Does anyone know
    if it is possible to access attributes in the API?

    Thanks
    Chris
     
    Chris Tellers, Jun 1, 2004
    #5
  6. Yes it is possible to set and read attributes in API. Here is an example.
    This sets fields on my form to the values in the block passed to the
    function.

    Public Sub GetCurrentAttributes(BlockName As SldWorks.BlockInstance)

    RevisionForm.REV1.Value = BlockName.GetAttributeValue("TOP LETTER")
    RevisionForm.REV2.Value = BlockName.GetAttributeValue("MID LETTER")
    RevisionForm.REV3.Value = BlockName.GetAttributeValue("BOT LETTER")
    RevisionForm.Description1.Value = BlockName.GetAttributeValue("TOP
    DESC")
    RevisionForm.Description2.Value = BlockName.GetAttributeValue("MID
    DESC")
    RevisionForm.Description3.Value = BlockName.GetAttributeValue("BOT
    DESC")
    RevisionForm.Date1.Value = BlockName.GetAttributeValue("TOP DATE")
    RevisionForm.Date2.Value = BlockName.GetAttributeValue("MID DATE")
    RevisionForm.Date3.Value = BlockName.GetAttributeValue("BOT DATE")
    RevisionForm.DateNew.Value = Month(Now) & "-" & Day(Now) &
    VBA.Chr(vbKeyReturn) & VBA.Right(Year(Now), 2)
    'REVISIONFORM.RevNew.Value =

    End Sub



    and this one sets them to the new values in the form

    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

    Of course you will first have to attach to SW the Document and the correct
    instance of the block (which would have to have the proper field names
    setup.)

    You could also save out your sheet format and apply it to each sheet the
    only problem is that if there are changes to individual sheets they will be
    hard to manage.

    Corey
     
    Corey Scheich, Jun 1, 2004
    #6
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.