Jump to content

Attach Xref from different folders


au-s

Recommended Posts

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

Link to comment
Share on other sites

Hey Aus,

 

I think I recognise that code from somewhere.... :P

 

Are you saying you would like to continue inserting XREFs until the users decides to stop?

 

instead of invoking the command each time?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...