• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Visual LISP, AutoLISP and General Customization

    Reply
    Valued Mentor
    gjrcmb
    Posts: 322
    Registered: ‎06-21-2011

    Re: Extract Field Expression

    03-13-2012 09:25 PM in reply to: gjrcmb

    Since all this is fresh on my mind, I went ahead and proceeded with my latest thoughts.

     

    Alright, so I put together a Construct Field application as described in my previous posting that actually extracts an Object ID of a Block Attribute and constructs a Field Expression with that Object ID, and then allows you to create a MText Object on Layout A00 that has the Field Expression Inserted in the MText.  Sound like I got it this time?

     

    Anyway try the following with your FielBetweenTabs.dwg:

    • Load the attached ConstructField.lsp file.
    • Type ConstructField (can always change the name)
    • On the A01 Layout tab, select the Attribute displaying Site Plan when asked to "Select Attribute Definition Embedded in Block:"
    • The application automatically switches to the the A00 Layout tab. (could be changed or prompted for)
    • Specify the First Corner of MText Object on A00 Layout.
    • Specify Second Corner of MText Object on A00 Layout.
    • The application should place a MText object with the Inserted Field Expression that references the Attribute Object you selected on A01.
    • The application exits.

    Hopefully that worked for you.  You could conceivably get fancier and somehow select multiple Block Attributes and build a Drawing List or Table of Contents, or possibly automate the whole selection and building process.

    Please use plain text.
    Valued Contributor
    msarqui
    Posts: 89
    Registered: ‎09-14-2010

    Re: Extract Field Expression

    03-14-2012 10:13 AM in reply to: gjrcmb

    This is exactly what I wanted! The ConstructField.lsp routine works perfectly for my purposes. Thank you very much!

     

    I'd like to apologize for having used the wrong term. You have reason, I should have asked for "Construct" a Field Expression, or, like you said, for a lisp to extracts an Object ID of a Block Attribute and constructs a Field Expression with that Object ID.

     

    Since now we are on track, I would like to ask a question:

    When you said: "The application automatically switches to the the A00 Layout tab. (could be changed or prompted for)"

    Is that possible to be promped for?

    Perhaps the lisp routine could show a dialog box with a list of all layouts in the drawing, and then I could pick one of them. This is just an idea because I saw this on another lisp routine here in the Discussion Groups and it would be possible.

    I ask this because in some projects, my first layout tab has a different name than A00.

    

    Well, I would like to thank you again for the great job.

     

    Marcelo

    Please use plain text.
    Valued Mentor
    gjrcmb
    Posts: 322
    Registered: ‎06-21-2011

    Re: Extract Field Expression

    03-14-2012 11:44 AM in reply to: msarqui

    Great.  Glad we finally got something that works for you and essentially does what you want it to do.  :smileyhappy:

     

    Well, sometimes it is cumbersome communicating by non-verbal means, and not always the best way to get a clear understanding of what each other is talking about.  So as I said, no worries.  I am now much more versed on the topic, so even though I went down some paths of knowledge that I really didn't need to for the final outcome, they are still items that are valuable to know.

     

    The attached lisp has been modified to prompt you to enter a Layout tab name.  While you could undoubtly design a dialog control box to select the layout tab, this is another undertaking that I am not going to get into right now.

     

    So good luck with it.  Don't be afraid to learn Lisp or perhaps .NET, if you have not got into it before.

     

    You're welcome,

     

     

    Please use plain text.