Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Editing a Revision Table (Changing Block Table Property for all Layouts)

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
b_bothof
1338 Views, 6 Replies

Editing a Revision Table (Changing Block Table Property for all Layouts)

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 🙂 )

2018-08-28_17-06-09.gif

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!

6 REPLIES 6
Message 2 of 7
pbejse
in reply to: b_bothof


@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.

 

 

 

Message 3 of 7
b_bothof
in reply to: pbejse

Hey, thanks for your reply!

 

Yes, I meant user input. Do you have any ideas where to start? 🙂

Message 4 of 7
pbejse
in reply to: b_bothof


@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.

 

 

 

 

 

Message 5 of 7
b_bothof
in reply to: pbejse

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!

Message 6 of 7
pbejse
in reply to: b_bothof


@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

 

 

 

 

 

 

Message 7 of 7
b_bothof
in reply to: pbejse

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.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report