au-s Posted January 29, 2009 Posted January 29, 2009 Hello... I've got this: (defun c:XREFIN (/ varlist oldvars ans) (setq varlist (list "CMDECHO" "CLAYER" "CTAB") oldvars (mapcar 'getvar varlist)) (setvar "cmdecho" 0) (if (/= (getvar "ctab") "Model") (progn (setq svar (dos_msgbox "New VPORT" "New VPORT?" 4 3 ) ) (IF (= svar 6) (progn (if (not (tblsearch "LAYER" "P-------VPORT")) (command "-layer" "M" "P-------VPORT" "C" "7" "P-------VPORT" "P" "N" "P-------VPORT" "") (setvar "clayer" "P-------VPORT")) (prompt "Create New VPORT...") (command "-vports" pause pause))) (setvar "ctab" "MODEL") (command "_.ucs" "w") (if (not (tblsearch "LAYER" "P-------XREF")) (command "-layer" "M" "P-------XREF" "C" "7" "P-------XREF" "LO" "P-------XREF" "") (setvar "clayer" "P-------XREF")) (command "._XAttach") (while (> (getvar "CMDACTIVE") 0) (command pause)) (command "_.ucs" "P")) (alert "VPORT cant be created in modelspace!!")) (mapcar 'setvar varlist oldvars) (princ)) Can I use the xattach above and to somehow first ask me "Do you want to atach from another folder?" If yes, I can go to another folder, if no it continues=? Is it possible to attach xrefs from another folders? Best regards! I think I need to have the similiar function (if (/= smothing ...) (progn (setq svar (dos_msgbox "From another Folder" "From another folder?" 4 3 ) ) (IF (= svar 6) (progn .... Another folder or not lisp-code ... Quote
Lee Mac Posted January 29, 2009 Posted January 29, 2009 Hey Aus, I think I recognise that code from somewhere.... Are you saying you would like to continue inserting XREFs until the users decides to stop? instead of invoking the command each time? Quote
Lee Mac Posted January 29, 2009 Posted January 29, 2009 I don't have dos functions, but perhaps: (defun c:XREFIN (/ varlist oldvars svar flag ans) (setq varlist (list "CMDECHO" "CLAYER" "CTAB") oldvars (mapcar 'getvar varlist)) (setvar "cmdecho" 0) (if (/= (getvar "ctab") "Model") (progn (initget "Yes No") (setq svar (getkword "\nNew Viewport? {Y/N} <No> : ")) (if (= "Yes" svar) (progn (if (not (tblsearch "LAYER" "P-------VPORT")) (command "-layer" "M" "P-------VPORT" "C" "7" "P-------VPORT" "P" "N" "P-------VPORT" "") (setvar "clayer" "P-------VPORT")) (prompt "Create New VPORT...") (command "-vports" pause pause))) (setvar "ctab" "MODEL") (command "_.ucs" "w") (if (not (tblsearch "LAYER" "P-------XREF")) (command "-layer" "M" "P-------XREF" "C" "7" "P-------XREF" "LO" "P-------XREF" "") (setvar "clayer" "P-------XREF")) (while (not flag) (command "._XAttach") (while (> (getvar "CMDACTIVE") 0) (command pause)) (initget "Yes No") (setq ans (getkword "\nInsert Another? {Y/N} <Yes> : ")) (if (= ans "No") (setq flag T))) (command "_.ucs" "P")) (alert "VPORT cant be created in modelspace!!")) (mapcar 'setvar varlist oldvars) (princ)) Quote
au-s Posted January 30, 2009 Author Posted January 30, 2009 Thanx Sir for the great help. Exactly what I wanted... Regards! 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.