BUNANOG Posted February 18, 2013 Posted February 18, 2013 Hi All, I'm very new to lisp. I need help on a command that i wrote that works like the "_insert" command. Evertyhing works except that everytime i execute the command, it goes back to a default location that i set it to. I would like it to basically open the previous file folder where the block just got pulled off from when im trying to insert the block on a new file. Thanks in advance and im looking forward to learn some more. Quote
Tharwat Posted February 18, 2013 Posted February 18, 2013 Welcome to the forum Can you post your codes to check them out for you ? Quote
BUNANOG Posted February 18, 2013 Author Posted February 18, 2013 Thank you so much. Here is the code (defun c:insdat (/ bti) (command "._-layer" "m" "G-PLAN-DATM-____-____-N" "lo" "G-PLAN-DATM-____-____-N" "") (if (setq bti (getfiled "select block to insert" "J:\\" "dwg" 0)) (progn (command "._-Insert" bti "_S" 1.0 "0,0,0" 0.00 "" "") (while (/= 0 (getvar "CMDACTIVE")) (command pause) ) ) (princ "\nNo File Selected.") ) (princ) (setvar 'CLAYER "0") ) Quote
SLW210 Posted February 18, 2013 Posted February 18, 2013 Please read the CODE POSTING GUIDELINES and use CODE TAGS for your Code, not QUOTE TAGS. Quote
Tharwat Posted February 18, 2013 Posted February 18, 2013 Try this draft at the moment .... (defun c:Test (/ _Ins *error* cl pt) ;;; Tharwat 19. Feb. 2013 ;;; (vl-load-com) (defun _Ins (p bk) (entmakex (list '(0 . "INSERT") (cons 2 bk) (cons 10 p) '(41 . 1.) '(42 . 1.) '(43 . 1.) ) ) ) (defun *error* (x) (if cl (setvar 'clayer cl) ) (princ "\n*Cancel*") ) (setq cl (getvar 'clayer)) (if (not (tblsearch "LAYER" "G-PLAN-DATM-____-____-N")) (command "._-layer" "m" "G-PLAN-DATM-____-____-N" "") (setvar 'clayer "G-PLAN-DATM-____-____-N") ) (if (not *Blockname*) (progn (setq *Blockname* (getfiled "select block to insert" "J:\\" "dwg" 0) ) (command "._-Insert" *Blockname* '(0. 0. 0.) nil) (while (setq pt (getpoint (strcat "\n Specify insertio point for block < " (vl-filename-base *Blockname*) " > :" ) ) ) (_Ins pt (vl-filename-base *Blockname*)) ) ) (while (setq pt (getpoint (strcat "\n Specify insertio point for block " (if *Blockname* (strcat " < " (vl-filename-base *BlockName*) " > :") " :" ) ) ) ) (_Ins pt (vl-filename-base *Blockname*)) ) ) (if cl (setvar 'CLAYER cl) ) (princ) ) 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.