Jump to content

Recommended Posts

Posted

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.

Posted

Welcome to the forum :)

 

Can you post your codes to check them out for you ?

Posted

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

)

Posted

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

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