PDA

View Full Version : Converting a script/macro to a LISP file?


mpeterson79
2007-10-16, 05:47 PM
I have a custom button that a former coworker created for copying objects from model space to paperspace. AutoCAD's CHSPACE command only transfers an object from one 'space' to another, therefore destroying the underlying entities.

How might I go about converting the following code to a LISP routine in order to better share it with other co-workers?


^C^Cselect;\copy;p;;0,0;0,0;chspace;p;;flatten;p;;


Thanks for any help.

rkmcswain
2008-12-21, 09:57 PM
Flatten can't be run from lisp since it's externally defined and won't accept arguments. You could write your own flatten code possibly. Here is the rest...


(defun c:foo ( / sset)
(setq sset (ssget))
(command "._copy" sset "" "" (list 0.0 0.0 0.0))
(command "._chspace" "_P" "")
)

Lions60
2008-12-22, 03:17 PM
If you look at your autocad express files and find the file called flattensup.lsp you can look through the many functions and call those as you would any lisp reference and pass the arguments to those functions. For Example:
(acet-flatn SelectionSet HideHiddenLinesVariable)