claire2017 Posted March 9, 2018 Posted March 9, 2018 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 trial.dwg Quote
iconeo Posted March 9, 2018 Posted March 9, 2018 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 Quote
danellis Posted March 9, 2018 Posted March 9, 2018 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 Quote
BIGAL Posted March 10, 2018 Posted March 10, 2018 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 Quote
claire2017 Posted March 14, 2018 Author Posted March 14, 2018 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? Quote
BIGAL Posted March 14, 2018 Posted March 14, 2018 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. Quote
danellis Posted March 14, 2018 Posted March 14, 2018 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 Quote
BIGAL Posted March 14, 2018 Posted March 14, 2018 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. ;; 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) Getvals4.lsp Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.