Results 1 to 7 of 7

Thread: Block insertion

  1. #1
    Member
    Join Date
    2001-11
    Location
    Manchester, UK
    Posts
    47

    Default Block insertion

    Can anyone help?

    I am trying to add a block definition into a drawing but not to insert it. I want the definition to match that of a block already existing on disk which is actually just an attribute. I have studied the online help in AutoCAD (2004) but am having difficulty because it isn't very good.

    Thanks in advance.

  2. #2
    100 Club mtuersley's Avatar
    Join Date
    2001-12
    Posts
    122

    Default Re: Block insertion

    Think about it, Jim....you could just insert it then immediately delete it. That's probably the easiest, simplest way.

  3. #3
    Member
    Join Date
    2001-11
    Location
    Manchester, UK
    Posts
    47

    Smile Re: Block insertion

    Yes tried that but because the block is an attribute I couldn't get it to insert with a default attribute value following the Autodesk sample code for inserting blocks. When I inserted the block there was no error given but AutoCAD seemed to be waiting for user input and that bombed the vba script. I also tried putting in extra returns as you would on the command line but this also didn't work. Is there a correct syntax for doing it and if so could someone let me know?

    Thanks
    Last edited by jim.vipond; 2005-01-28 at 08:20 AM.

  4. #4
    Member
    Join Date
    2005-01
    Posts
    5

    Red face Re: Block insertion

    try inserting the block to some new drawing ...
    explode it ...
    copy it to taget drawing using ctrl+c -> ctrl+v ...
    in target drawing use the AutoCad command ATTREDEF ...

    or

    use the ATTRIBUTE MANAGER in AutoCad 2002 and above to change the Atttribute right in the existing block

    www.plan-net.org

  5. #5
    All AUGI, all the time
    Join Date
    2003-12
    Location
    Northern California
    Posts
    561

    Default Re: Block insertion

    Does this help you?
    Code:
    Sub blocktest()
    Dim oBlkRef As AcadBlockReference
    Dim oblk As AcadBlock
    Dim oEnt As AcadEntity
    Dim oAtt As AcadAttribute
    Dim dPt(2) As Double
    Dim sName As String
    
    sName = "c:\testblock.dwg"
    Set oBlkRef = ThisDrawing.ModelSpace.InsertBlock(dPt, sName, 1#, 1#, 1#, 0#)
    sName = oBlkRef.Name
    oBlkRef.Delete
    Set oblk = ThisDrawing.Blocks.Item(sName)
    For Each oEnt In oblk
        If TypeOf oEnt Is AcadAttribute Then
            Set oAtt = oEnt
            oAtt.TextString = "My new default value"
        End If
    Next
    End Sub

  6. #6
    Member
    Join Date
    2001-11
    Location
    Manchester, UK
    Posts
    47

    Thumbs up Re: Block insertion

    Thanks everyone for your replies so far.

    miff
    When i have used the InsertBlock method it seems AutoCAD is pausing for user input of the attribute value. What I intended to try is turning off the "attreq" variable before inserting
    the block but it will now have to wait for a couple of days before I can get round to it again. I will also try adding a value to the attribute as you have shown to see if this clears the pause.

    Thanks again.

  7. #7
    100 Club
    Join Date
    2000-11
    Location
    Adelaide, South Australia
    Posts
    116

    Default Re: Block insertion

    Something else is wrong because the VBA InsertBlock method does not prompt for attribute values despite of what the "attreq" variable is set to.
    Regards - Nathan

Similar Threads

  1. Block insertion tool
    By richard.kunigisky in forum AutoCAD Customization
    Replies: 6
    Last Post: 2009-02-24, 01:37 PM
  2. Loose dynamic states from sub block after insertion into master block
    By ANRCREATIONS in forum Dynamic Blocks - Technical
    Replies: 5
    Last Post: 2005-11-15, 01:41 PM
  3. Block Insertion
    By chuston.91700 in forum AutoCAD General
    Replies: 4
    Last Post: 2005-08-05, 06:29 PM
  4. Block insertion
    By bandent in forum AutoLISP
    Replies: 1
    Last Post: 2005-01-25, 11:38 AM
  5. z-scale for block insertion
    By Katika in forum AutoCAD General
    Replies: 2
    Last Post: 2004-11-29, 03:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •