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

Continuing a lisp routine in a new drawing

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
JEdwardL
709 Views, 4 Replies

Continuing a lisp routine in a new drawing

I've created a new drawing using VLA-ADD.  I have data that I want to import into this drawing and then save it.  My problem is that when I switch to the new drawing the lisp routine is left behind in the previous namespace where it is paused, but continues to run.

 

I know there must be a way to do this, but I don't know how.  Can anybody throw me  a bone?

 

Thanks,

 

J Leavitt

4 REPLIES 4
Message 2 of 5
pbejse
in reply to: JEdwardL

vl-propagate 
 
 Copies the value of a variable into all open document namespaces (and sets its value in any subsequent drawings opened during the current AutoCAD session

 

(defun c:test ()

	(if (not Value)
	 	(setq value 1.00)
	  )
  	(setq Real_value (getreal (strcat "\nEnter Value<: " (rtos value 2 2) ">: ")))
	(if (not real_value)
	  	(setq real_value value))
	(setq Add_val (getreal "\nEnter Value to add: "))
  	(setq New_value (+ Add_val Real_value))
	(setq value new_value)
  	(vl-propagate 'value)
  	(princ New_value)
  	(princ)
  	
  	)

 

The variable value will keep its value on the next open document.


Hope this helps Smiley Happy

Message 3 of 5
JEdwardL
in reply to: pbejse

That was pretty slick, but I was actually looking to close switch back to my original drawing and then close the drawing that I'd created so that the lisp routine that created the drawing in the first place would continue.

 

I learned most of my LISP before Visual Lisp was implemented and I've failed to keep up, mostly because I can't find adequate documentation on the VLA- functions.  Is there a source that you know of?

 

Thanks for your help.

 

J Leavitt

Message 4 of 5
pbejse
in reply to: JEdwardL

This is a good starting point:

Click me to learn VLisp

 

Now regarding open/save issues. see my reply on your other post Drawingis Busy Error

 

Hope this helps Smiley Happy

Message 5 of 5
JEdwardL
in reply to: pbejse

Thanks for the Resources...Excellent!

 

I solved my problem by invoking a VLA-SAVEAS in my "script" routine. Problem solved.

 

Thank you very much!

 

J Leavitt

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

”Boost