Hey everyone,
This is my first post here, so hi! I think this is the right place to ask for help, but if not, I'm sorry!
I would like to get some help getting started to write a LISP to do the following, but for each Layout/specific Dynamic Blocks in the dwg. Below is a GIF (in Dutch 🙂 )
Eventually, I would like the user to press a button in a toolbar and get asked: "What is the revision number?" and then the user can simply insert 0, a or b for instance. Once the user has given their input, it will change the Block Table Property for all the layouts in the drawing.
Basically, every layout has exactly one of the mentioned Dynamic Block.
Do you guys think this is an efficient method? And if so, do you guys have any resources to write the LISP or could help me write it?
Thanks a lot!
Solved! Go to Solution.
Hey everyone,
This is my first post here, so hi! I think this is the right place to ask for help, but if not, I'm sorry!
I would like to get some help getting started to write a LISP to do the following, but for each Layout/specific Dynamic Blocks in the dwg. Below is a GIF (in Dutch 🙂 )
Eventually, I would like the user to press a button in a toolbar and get asked: "What is the revision number?" and then the user can simply insert 0, a or b for instance. Once the user has given their input, it will change the Block Table Property for all the layouts in the drawing.
Basically, every layout has exactly one of the mentioned Dynamic Block.
Do you guys think this is an efficient method? And if so, do you guys have any resources to write the LISP or could help me write it?
Thanks a lot!
Solved! Go to Solution.
Solved by pbejse. Go to Solution.
@b_bothof wrote:
Hey everyone,
...Eventually, I would like the user to press a button in a toolbar and get asked: "What is the revision number?" and then the user can simply insert 0, a or b for instance. Once the user has given their input, it will change the Block Table Property for all the layouts in the drawing.
... do you guys have any resources to write the LISP or could help me write it?
Assuming you meant user input.
Sure there is and yes we can.
@b_bothof wrote:
Hey everyone,
...Eventually, I would like the user to press a button in a toolbar and get asked: "What is the revision number?" and then the user can simply insert 0, a or b for instance. Once the user has given their input, it will change the Block Table Property for all the layouts in the drawing.
... do you guys have any resources to write the LISP or could help me write it?
Assuming you meant user input.
Sure there is and yes we can.
Hey, thanks for your reply!
Yes, I meant user input. Do you have any ideas where to start? 🙂
Hey, thanks for your reply!
Yes, I meant user input. Do you have any ideas where to start? 🙂
@b_bothof wrote:
Yes, I meant user input. Do you have any ideas where to start? 🙂
What you're asking is not difficult at all,
Post a sample drawing along with the dynamic block then I'll write one for you.
@b_bothof wrote:
Yes, I meant user input. Do you have any ideas where to start? 🙂
What you're asking is not difficult at all,
Post a sample drawing along with the dynamic block then I'll write one for you.
Thank you very much!
In the attachments, you'll see the dwg. The Dynamic Block is inserted in Layout 1 and Layout 2.
I have used the generic template with metric units and coverted it to meters.
I hope this is enough information!
Thank you very much!
In the attachments, you'll see the dwg. The Dynamic Block is inserted in Layout 1 and Layout 2.
I have used the generic template with metric units and coverted it to meters.
I hope this is enough information!
@b_bothof wrote:
In the attachments, you'll see the dwg. The Dynamic Block is inserted in Layout 1 and Layout 2.
I have used the generic template with metric units and coverted it to meters.
Try this
(defun c:RFTS ( / rev_value sel_value Rev_DB i e dp) ; RevForThisSheet (initget "0 A B C") (if (and (setq rev_value (getkword "\nWhat is the revision number [0/A/B/C]; ")) (setq sel_value (strcat "Revisie " (strcase rev_value T))) (setq Rev_DB (ssget "_X" '((0 . "INSERT")(66 . 1)(2 . "`*U*,RE_Revisietabel")))) ) (repeat (setq i (sslength Rev_DB)) (setq e (vlax-ename->vla-object (ssname Rev_DB (setq i (1- i))))) (if (and (eq "RE_REVISIETABEL" (Strcase (vla-get-EffectiveName e))) (setq dp (assoc "Revisienummer" (mapcar '(lambda (dp) (list (vlax-get dp 'PropertyName) (vlax-get dp 'Value) dp ) ) (vlax-invoke e 'GetDynamicBlockProperties) ) ) ) (/= (cadr dp) sel_value) ) (vlax-put (caddr dp) 'Value sel_value) ) ) ) (princ) )
HTH
@b_bothof wrote:
In the attachments, you'll see the dwg. The Dynamic Block is inserted in Layout 1 and Layout 2.
I have used the generic template with metric units and coverted it to meters.
Try this
(defun c:RFTS ( / rev_value sel_value Rev_DB i e dp) ; RevForThisSheet (initget "0 A B C") (if (and (setq rev_value (getkword "\nWhat is the revision number [0/A/B/C]; ")) (setq sel_value (strcat "Revisie " (strcase rev_value T))) (setq Rev_DB (ssget "_X" '((0 . "INSERT")(66 . 1)(2 . "`*U*,RE_Revisietabel")))) ) (repeat (setq i (sslength Rev_DB)) (setq e (vlax-ename->vla-object (ssname Rev_DB (setq i (1- i))))) (if (and (eq "RE_REVISIETABEL" (Strcase (vla-get-EffectiveName e))) (setq dp (assoc "Revisienummer" (mapcar '(lambda (dp) (list (vlax-get dp 'PropertyName) (vlax-get dp 'Value) dp ) ) (vlax-invoke e 'GetDynamicBlockProperties) ) ) ) (/= (cadr dp) sel_value) ) (vlax-put (caddr dp) 'Value sel_value) ) ) ) (princ) )
HTH
This is amazing, thank you so much! I'm gonna review the code and try to learn from it.
You have written this code in so few lines, I thought it was quite complicated. Really awesome!
This is amazing, thank you so much! I'm gonna review the code and try to learn from it.
You have written this code in so few lines, I thought it was quite complicated. Really awesome!
Can't find what you're looking for? Ask the community or share your knowledge.