+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Forum Newbie
    Discipline
    Architectural
    Using
    AutoCAD 2017
    Join Date
    Oct 2017
    Posts
    2

    Default Applying attributes to dynamic block & extracting to table

    Registered forum members do not see this ad.

    Hi All,
    I'm very new to these so please be nice!

    Basically our company cuts heaps of metal panels. We draw each panel, do the cutting lists, nest and optimise them on sheets manually. I'm trying to save some time by creating a block that'll make life a bit easier.

    So I've currently got a block where you can input the height and width & it automatically adjusts.
    What I'd like to add is an atrribute? or a tag? where that little box pops up and you can input the height & width in there instead. Additionally I'd like the pop up box to include the panel # which is then shown on the panel (see drawing where I've just added in 'a1', 'a2' etc).

    Next step would be to include a table that collates the information from all the panels (we often do around 30 panels per order). Currently we manually input all the sizes in to excel.

    Just to make things more interesting we use metric autocad but are often given dimensions in imperial, so half the time is spent manually converting feet & inches into mm and then drawing the panels in mm. If there's any way to input in imperial and show both metric and imperial on the dimension line that would just be the best thing ever!

    I might be being a bit greedy with so many requests so if anyone could help with just one of the above it would be very much appreciated.

    Thankyou
    Attached Files

  2. #2
    Senior Member
    Computer Details
    iconeo's Computer Details
    Operating System:
    Windows
    Discipline
    Multi-disciplinary
    iconeo's Discipline Details
    Occupation
    CAD Manager/Draftsman
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2017
    Join Date
    Jun 2007
    Location
    Seattle
    Posts
    306

    Default

    Luckily, this is all within the realm of possible. You will need to use LISP in order to make this truly efficient though. Hope you are not using AutoCAD LT.

    1. Make block with all the information you need.
    2. Create LISP to generate table.

    Sent from my Pixel 2 XL using Tapatalk

  3. #3
    Senior Member
    Computer Details
    danellis's Computer Details
    Operating System:
    Windows 7
    Computer:
    Dell Precision T1650
    Using
    Architecture 2014
    Join Date
    Dec 2010
    Posts
    321

    Default

    Quote Originally Posted by claire2017 View Post
    Hi All,
    I'm very new to these so please be nice!

    So I've currently got a block where you can input the height and width & it automatically adjusts.
    What I'd like to add is an atrribute? or a tag? where that little box pops up and you can input the height & width in there instead. Additionally I'd like the pop up box to include the panel # which is then shown on the panel (see drawing where I've just added in 'a1', 'a2' etc).

    The "size note" is probably most easily done with a text element that uses FIELDS to read off the size of your horizontal and vertical parameter.


    I'll try to have a look over lunch to do you a walk-through if you want one...


    dJE

  4. #4
    Quantum Mechanic BIGAL's Avatar
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,702

    Default

    The panel to table can be done in a few ways, if you have a dynamic block then you can retrieve the L & W or if its a block you can get all the attribute values.

    You can write your own dimension routine that labels the dimension in both feet and metric
    A man who never made mistakes never made anything

  5. #5
    Forum Newbie
    Discipline
    Architectural
    Using
    AutoCAD 2017
    Join Date
    Oct 2017
    Posts
    2

    Default

    Quote Originally Posted by danellis View Post
    The "size note" is probably most easily done with a text element that uses FIELDS to read off the size of your horizontal and vertical parameter.


    I'll try to have a look over lunch to do you a walk-through if you want one...


    dJE

    That would be great, thankyou, I've tried playing with fields a bit but not having much luck. Is it possible to do it in reverse? So you input the parameter sizes into the attribute box & the panel updates in size accordingly?

  6. #6
    Quantum Mechanic BIGAL's Avatar
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,702

    Default

    You can via lisp set the L&W as a question which is passed to the block and rescales, I would start with lee-macs dynamic block lisps. If table exists you can do a last row add the details from the block just inserted. All in 1 lisp. Almost forgot add dims as well. Enter feet dim in mm

    For now edit the block now and add an attribute for label, use properties to change the sizes.

    Just a bit busy right now so if I have time will do something.
    A man who never made mistakes never made anything

  7. #7
    Senior Member
    Computer Details
    danellis's Computer Details
    Operating System:
    Windows 7
    Computer:
    Dell Precision T1650
    Using
    Architecture 2014
    Join Date
    Dec 2010
    Posts
    321

    Default

    Quote Originally Posted by claire2017 View Post
    That would be great, thankyou, I've tried playing with fields a bit but not having much luck. Is it possible to do it in reverse? So you input the parameter sizes into the attribute box & the panel updates in size accordingly?


    I'll write something up for you.


    You can't do it directly by entering attributes (or at least not so far as I'm aware), but using dynamic input would have the same effect.


    dJE

  8. #8
    Quantum Mechanic BIGAL's Avatar
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,702

    Default

    Registered forum members do not see this ad.

    I dont play much with dynamic blocks and I need to, but any way here is some thing to play with. There is a problem with your block I need to find it. Step two of this would be to use fields in the table as already suggested. The getvals allows for a dcl input rather than line by line.

    Code:
    ;; Get Dynamic Block Property Value  -  Lee Mac
    ;; Returns the value of a Dynamic Block property (if present)
    ;; blk - [vla] VLA Dynamic Block Reference object
    ;; prp - [str] Dynamic Block property name (case-insensitive)
    
    (defun LM:getdynpropvalue ( blk prp )
        (setq prp (strcase prp))
        (vl-some '(lambda ( x ) (if (= prp (strcase (vla-get-propertyname x))) (vlax-get x 'value)))
            (vlax-invoke blk 'getdynamicblockproperties)
        )
    )
    
    ;; Set Dynamic Block Property Value  -  Lee Mac
    ;; Modifies the value of a Dynamic Block property (if present)
    ;; blk - [vla] VLA Dynamic Block Reference object
    ;; prp - [str] Dynamic Block property name (case-insensitive)
    ;; val - [any] New value for property
    ;; Returns: [any] New value if successful, else nil
    
    (defun LM:setdynpropvalue ( blk prp val )
        (setq prp (strcase prp))
        (vl-some
           '(lambda ( x )
                (if (= prp (strcase (vla-get-propertyname x)))
                    (progn
                        (vla-put-value x (vlax-make-variant val (vlax-variant-type (vla-get-value x))))
                        (cond (val) (t))
                    )
                )
            )
            (vlax-invoke blk 'getdynamicblockproperties)
        )
    )
    
    ;sample code starts here
    (defun c:panins ( )
    (setvar "insunits" 4)
    (if (= panelnum nil)(setq panelnum 1))
    (if (= panelnumx nil)(setq panelnumx 1))
    (if (not AH:getval4)(Load "getvals4"))
    (ah:getval4 "Enter height" 9 7 "600" "Enter width " 9 7 "600"  "Panel number " 9 7 (rtos panelnum 2 0) "Enter panel block 1 or 2" 4 3 (rtos panelnumx 2 0))
    (setq pt (getpoint "pick insertion point"))
    (command "-insert" (strcat  "panel " (rtos panelnumx 2 0))   pt 1 1 0 val2 val2)
    (setq blk (vlax-ename->vla-object (entlast)))
    (LM:setdynpropvalue  blk "HEIGHT" (atof val1) )
    (LM:setdynpropvalue  blk "WIDTH" (atof val2) )
    (setq panelnum (+ panelnum 1))pani
    )
    
    (c:panins)
    Attached Files
    A man who never made mistakes never made anything

Similar Threads

  1. Extracting data from block to table
    By etiennechausse in forum AutoCAD Drawing Management & Output
    Replies: 0
    Last Post: 8th Jun 2012, 02:58 pm
  2. Applying a rotation to attributes in a block
    By Stillwater67 in forum AutoCAD Beginners' Area
    Replies: 5
    Last Post: 5th Apr 2011, 03:33 am
  3. Extracting certain attributes from a block in multiple dwgs.
    By chauncy274 in forum AutoLISP, Visual LISP & DCL
    Replies: 12
    Last Post: 23rd Dec 2008, 05:57 pm
  4. Block Attributes in table?
    By LKJR in forum AutoCAD Drawing Management & Output
    Replies: 1
    Last Post: 26th Mar 2008, 10:51 pm
  5. Extracting Block attributes to Access Table
    By dmitchell@estesmcclure.co in forum AutoLISP, Visual LISP & DCL
    Replies: 13
    Last Post: 30th May 2005, 03:06 pm

Tags for this Thread

Bookmarks

Posting Permissions

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