Title Block Newbee

Discussion in 'AutoCAD' started by manoj_vest, May 27, 2004.

  1. manoj_vest

    manoj_vest Guest

    I am new in case of title block. So can any body help me out in following situation?

    1. I want to insert different title block in different layout. I know the block name but I don't know how to inser that.

    2. I want to know which title block is residing in which layout?

    3. Is there only method to get the title block object is filtered selection or is there any other method to do that? I was thinking that the title block reference will be residing some where like modelspace or paper space or layout. Just iterate that collection and get the object. Is it possible?

    Thanks in advance

    Manoj
     
    manoj_vest, May 27, 2004
    #1
  2. manoj_vest

    Ben Rand Guest

    Manoj,

    Here's a couple of samples to get you started. I've put most of the
    explanation as comments in each Sub.

    Public Sub TestInsert()
    Dim Layout As AcadLayout
    Dim vInsPt(0 To 2) As Double
    Dim sBlkName As String

    'Insertion point is an array of doubles (X,Y,Z values)
    vInsPt(0) = 0: vInsPt(1) = 0: vInsPt(2) = 0

    'Iterate each layout
    For Each Layout In ThisDrawing.Layouts
    'Set the block name using the Layout name
    Select Case Layout.Name
    Case "CE22X34STD"
    sBlkName = "1"
    Case "Layout1"
    sBlkName = "2"
    End Select
    'Inserting the block into the layouts "block" collection
    'Normally, you'd insert to ThisDrawing.ModelSpace or
    ThisDrawing.PaperSpace
    Layout.Block.InsertBlock vInsPt, sBlkName, 1, 1, 1, 0
    Next Layout
    End Sub

    Public Sub ListBlockByLayout()
    Dim col As New Collection
    Dim oLayoutObj As AcadObject
    Dim oEnt As AcadEntity
    Dim oBlkRef As AcadBlockReference
    Dim I As Integer
    Dim Layout As AcadLayout

    'Iterate each Layout
    For Each Layout In ThisDrawing.Layouts
    'Iterate the entities stored in each layouts "block" collection
    For Each oEnt In Layout.Block
    'if the entity type is an AcadBlockReference
    If TypeOf oEnt Is AcadBlockReference Then
    Set oBlkRef = oEnt
    'Add the layout name and block name to a collection
    col.Add Layout.Name & ": " & oBlkRef.Name
    End If
    Next oEnt
    Next Layout

    If col.Count > 0 Then
    'Loop the collection and dump it to the Output window
    For I = 1 To col.Count
    'Do some processing here...
    Debug.Print col(I)
    Next I
    End If
    End Sub

    Ben Rand
    CAD Manager
    CEntry Constructors & Engineers


    block name but I don't know how to inser that.
    selection or is there any other method to do that? I was thinking that the
    title block reference will be residing some where like modelspace or paper
    space or layout. Just iterate that collection and get the object. Is it
    possible?
     
    Ben Rand, May 27, 2004
    #2
  3. manoj_vest

    manoj_vest Guest

    Hi Ben,

    Thanks for your replay. It is working greate for me.

    Thanks again

    Manoj
     
    manoj_vest, May 28, 2004
    #3
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.