See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Loose Attributes on Drawing

  1. #1
    AUGI Addict MikeJarosz's Avatar
    Join Date
    2015-10
    Location
    New York NY
    Posts
    1,497
    Login to Give a bone
    0

    Default Loose Attributes on Drawing

    I have inherited the CAD manager position for a large project that has been under way for some time now. Certain important CAD standards have been ignored and it is my job to fix this condition. In particular, our sheet standards require that the title block and the issue date be blocks with well defined attribute tags to facilitate retrieval. We have programs in VBA and Object DBX that read this title block and issue information efficiently and quickly and generate management reports.



    Most of the drawings have incorrectly inserted the title block information as simple text. I propose to retrieve this text and its insertion coordinates with a VBA filter and then sort by the Y value and then the X value. I will then erase the text, insert the correct block and set the attribute text from the stored values. This should work with most of the sheets. I am confident I have the skill to do this; I have done it before successfully.



    Some of the text was inserted as a non standard block. That can be exploded without too much fuss.



    My problem is that the issue dates have been inserted as loose attributes, not associated with any block. If you examine the issue date info in the attached file, you will find a very strange condition. The attribute has no value, and the displayed text on the drawing is in fact the tag! Even if I edit the attribute to have an explicit value, it still displays the tag and not the value.



    I have tried exploding the attribute. I have tried express tools/attribute to text. After consulting with other experienced CAD managers, still no solution. There are several thousand drawings involved and any procedure will have to be automated through VBA. (I don't really know Lisp)



    Attached is a bound sheet with the essential border, title and issue date information. The client and data have been removed to protect the innocent.

    If you like puzzles, you'll like this!
    Attached Files Attached Files

  2. #2
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,420
    Login to Give a bone
    0

    Default Re: Loose Attributes on Drawing

    The ET tool requires that you start with a block. I wrote a lisp that does what you need some time ago. See attached. It uses the tag value to create text. You could also incorporate that idea into your vba.
    Attached Files Attached Files
    C:> ED WORKING....


    LinkedIn

  3. #3
    All AUGI, all the time zoomharis's Avatar
    Join Date
    2005-02
    Location
    Abu Dhabi (Native-India)
    Posts
    506
    Login to Give a bone
    0

    Default Re: Loose Attributes on Drawing

    Quote Originally Posted by MikeJarosz
    My problem is that the issue dates have been inserted as loose attributes, not associated with any block. If you examine the issue date info in the attached file, you will find a very strange condition. The attribute has no value, and the displayed text on the drawing is in fact the tag! Even if I edit the attribute to have an explicit value, it still displays the tag and not the value.



    I have tried exploding the attribute. I have tried express tools/attribute to text. After consulting with other experienced CAD managers, still no solution. There are several thousand drawings involved and any procedure will have to be automated through VBA. (I don't really know Lisp)



    Attached is a bound sheet with the essential border, title and issue date information. The client and data have been removed to protect the innocent.

    If you like puzzles, you'll like this!
    Hi Mike,
    There is nothing unusual in your drawing other than improper use of AutoCAD objects. The main thing to know is the difference between a defenition and an instance. Technically speaking, a Block means the defenition of a block and a Block Reference means the instance of that block. Likewise, an attribute has two states. One is Attribute Definition and the other is Attribute Reference. Basically an attribute definition is a part of block definiton. Once you insert the block, an instance (attribute reference) of attribute definition is made inside the block reference. What happens when you create an attribute definition inside a drawing? You are not supposed to use it inside the same drawing.But you can insert this drawing in an another drawing to get the attribute reference of the attribute definition you made. In your case, some ignorant user just copied the title block definiton and pasted it into the target drawing, instead of inserting it. Here are some basic facts that I believe true to my knowledge.

    • You CAN NOT explode an attribute definiton.
    • You can not convert an attribute definition to text using the normal 'attribute (reference) to text' utilities.
    • An attribute reference cannot stand alone without being a part of block reference.
    • You MUST insert a block definition if it contains attribute definition in order to get proper result.
    Now you can use the lisp file from Ed to convert an attribute definition to text. If you need a VBA idea, here is a few lines of code on how to access the attribute definiton.
    Code:
     
    Sub AttDefToTxt()
    Dim ent As AcadEntity
    For Each ent In ThisDrawing.PaperSpace
    If TypeOf ent Is AcadAttribute Then
    	If ent.PromptString = "REV. DATE (DD/MM/YY)" Then
    		MsgBox ent.TagString
    	End If
    End If
    Next
    End Sub
    HTH

  4. #4
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,420
    Login to Give a bone
    0

    Default Re: Loose Attributes on Drawing

    Quote Originally Posted by zoomharis
    • An attribute reference cannot stand alone without being a part of block reference.
    Yes it can, the tag just looks like regular text.
    C:> ED WORKING....


    LinkedIn

  5. #5
    All AUGI, all the time zoomharis's Avatar
    Join Date
    2005-02
    Location
    Abu Dhabi (Native-India)
    Posts
    506
    Login to Give a bone
    0

    Default Re: Loose Attributes on Drawing

    Quote Originally Posted by Ed Jobe
    Yes it can, the tag just looks like regular text.
    Can you show me a sample Ed?
    Thanks.

  6. #6
    All AUGI, all the time zoomharis's Avatar
    Join Date
    2005-02
    Location
    Abu Dhabi (Native-India)
    Posts
    506
    Login to Give a bone
    0

    Default Re: Loose Attributes on Drawing

    Quote Originally Posted by Ed Jobe
    Yes it can, the tag just looks like regular text.
    Hi Ed Jobe,
    I am really confused about your statement. As far as I know, you can not have a stand alone attribute reference in your drawing and it MUST be part of a block reference. If you can show otherwise, that would be one of the best things I learn from this forum.

    Thanks for your time.

  7. #7
    AUGI Addict MikeJarosz's Avatar
    Join Date
    2015-10
    Location
    New York NY
    Posts
    1,497
    Login to Give a bone
    0

    Default Re: Loose Attributes on Drawing

    Quote Originally Posted by zoomharis
    Hi Ed Jobe,
    I am really confused about your statement. As far as I know, you can not have a stand alone attribute reference in your drawing and it MUST be part of a block reference. If you can show otherwise, that would be one of the best things I learn from this forum.

    Thanks for your time.
    Did you load the attached file? In the issue table, issue 0 and the other text (IFC, 26/07/07 and the initials), are all loose attributes. I've attached the properties form for the IFC text. I'm just about to try the Lisp routine.
    Attached Images Attached Images

  8. #8
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,420
    Login to Give a bone
    0

    Default Re: Loose Attributes on Drawing

    Quote Originally Posted by MikeJarosz
    Did you load the attached file? In the issue table, issue 0 and the other text (IFC, 26/07/07 and the initials), are all loose attributes. I've attached the properties form for the IFC text. I'm just about to try the Lisp routine.
    In addition, I did not say that they would still have attribute data. I mean, they don't disappear or something like that. Perhaps you need to clarify what you mean by "cannot stand alone". Think of the dwg that Mike posted as a block. You could insert it into another drawing, could you not? ...although that's not what he intended, the atts would work as designed even though the tags might not make sense.
    C:> ED WORKING....


    LinkedIn

  9. #9
    AUGI Addict MikeJarosz's Avatar
    Join Date
    2015-10
    Location
    New York NY
    Posts
    1,497
    Login to Give a bone
    0

    Default Re: Loose Attributes on Drawing

    Ed:

    Your lisp routine worked perfectly. Kinda sorry about the select -- this won't work for thousands of drawings. I'll have to adapt this to a batch process.

    As a CAD coordinator in a large firm, I have seen everything. You are exactly right when you say that the drawing I posted with loose attributes could be referenced into another drawing and Acad would prompt for the attribute value. Not that we would reference a paper space sheet file, but it can happen in data files.

    I had a user referencing a base plan into a large scale blowup. Every attempt to reference the file produced a prompt: "enter door number" I drove us crazy until we discovered one loose attribute in the base plan with the prompt "enter door number". I now have a cleanup routine that regularly reports loose attributes on drawings. They are not a substitute for loose text, nor are they a block either. They're ATTRIBUTES!

  10. #10
    AUGI Addict MikeJarosz's Avatar
    Join Date
    2015-10
    Location
    New York NY
    Posts
    1,497
    Login to Give a bone
    0

    Default Re: Loose Attributes on Drawing

    Solved the attribute problem in VBA. Easier than I first thought (with all your help of course)

    Code:
     
    '===========================================================================================
    Sub QP_ATTS()
    '===========================================================================================
    Dim Entity As AcadEntity
    Dim AttText As String
    Dim AttHeight As Double
    Dim AttScaleFactor As Double
    Dim Ipt As Variant
    
    For Each Entity In ThisDrawing.PaperSpace
    	If TypeOf Entity Is AcadAttribute Then
    		'get attribute properties
    		AttText = Entity.TagString
    		AttHeight = Entity.Height
    		AttScaleFactor = Entity.ScaleFactor
    		Ipt = Entity.InsertionPoint
    		
    		'delete attribute and insert text
    		ThisDrawing.StartUndoMark
    			Entity.Delete
    			Set Entity = ThisDrawing.PaperSpace.AddText(AttText, Ipt, AttHeight)
    			Entity.Layer = "BORDER"
    			Entity.ScaleFactor = AttScaleFactor
    		ThisDrawing.EndUndoMark
    	End If
    Next Entity
    
    Debug.Print "DONE"
    End Sub

Page 1 of 2 12 LastLast

Similar Threads

  1. 2012: Linking Drawing Properties with attributes
    By Darren Allen in forum AutoCAD General
    Replies: 4
    Last Post: 2011-11-18, 09:05 PM
  2. Copying Attributes from one drawing (or layout) to another
    By Inferno6919 in forum AutoCAD General
    Replies: 13
    Last Post: 2010-11-05, 01:38 PM
  3. How to link Block Attributes to Drawing Properties
    By dhendrickson in forum AutoCAD General
    Replies: 1
    Last Post: 2007-06-06, 08:38 PM
  4. Drawing frame Attributes not showing for others
    By steve.presland in forum AutoCAD General
    Replies: 3
    Last Post: 2006-03-23, 05:03 PM
  5. Get Attributes Without Opening Drawing Files
    By CADdancer in forum VBA/COM Interop
    Replies: 2
    Last Post: 2005-03-31, 03:48 PM

Posting Permissions

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