AutoFilling title Blocks

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

Reply to
Chris Tellers
Loading thread data ...

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

Dave H

Chris Tellers wrote:

Reply to
Dave H

...and you propably want something like SWit to save the properties to the model:

formatting link

Reply to
Markku Lehtola

Are you using the custom properties from your model file to fill the title block automatically?

Reply to
Rob Rodriguez

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

Reply to
Chris Tellers

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

Reply to
Corey Scheich

What I do is keep the same title block for every sheet. That means every sheet uses the same sheet format for that mold. I also will often detail several components on one sheet. I have a note that labels every part. The custom properties will reference the properties of the part that the annotation is attached to. I guess what I am talking about is a mini-title block for each compenent detail.

jk

" I often create many drawing sheets for each mold I design. "

Reply to
jk

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.