Jump to content

Create & Insert block - by grabbing info from another dwg to user specified XY


loveboatcaptain

Recommended Posts

I have a drawing that contains a map area to XY coordinates (MAP.dwg)

 

I am trying to create a lisp that will create & insert a block by grabbing element info from the MAP.dwg area (using user input) to XY co-ordinates

 

The lisp would need to open the MAP.dwg, copy elements from specified user XY co-ords, then insert as a block into the current drawing. I want the inserted block to be a consistent sized square.

 

Can anyone help or has anyone done something similar?

Link to comment
Share on other sites

I am currently using the below multiple lisps, one at a time, but want to automate it into one click.

 

 

\\INSERTS UKMAP

(defun C:insert_railmapuk ( )
(command "insunits" "4")	 
(command "osmode" "0" )
(command "-layer" "set" "0" "")
(command "-insert" "*UK" "0,0" "1" "0")
(princ)
)

\\INSERTS RAIL LOCATION MAP BOX

(defun C:INSERTZZMAP ( ) 
(command "INSUNITS" "4")
(command "-insert" "*scalemapmodel" pause "1" "0")
(princ)
)

\\CREATES MAP BLOCK

(defun C:CREATEZZMAP ( )
(command "-BLOCK" "MAP" "Y" pause)
(princ)
)

\\DELETES UKMAP IGNORES MAP BLOCK

(defun c:DELZZMAP (/ ss i sset e)
 (if
   (setq ss (ssget "_x" '((8 . "_ACM-BLCK-UKMAP-LANDLINE,_ACM-BLCK-UKMAP-RAIL,_ACM-BLCK-UKMAP-STATION,_ACM-BLCK-UKMAP-STATION NAME"))))
   (repeat
     (setq i (sslength ss))
     (setq sset (ssname ss (setq i (1- i))))
     (setq e (entget sset))
     (if (not (eq (cdr (assoc 2 e))"MAP"))
       (entdel sset)
     )
   )
   (princ)
 )
 (princ)
)


\\SCALES MAP BLOCK IN PAPER SPACE

(defun C:SCALEZZMAP ( ) 
(sssetfirst nil (ssget "_x" '((0 . "INSERT")(2 . "MAP"))))
(command "SCALE" "p" "" "1059,397.2416" "0.01")
(princ)
)


\\INSERTS RED DOT
(defun C:LOCATEZZMAP ( )
   (command "insunits" "4")	 
   (command "osmode" "0" )
   (command "-layer" "set" "0" "")
   (command "-insert" "*reddot" pause "1" "0")
   (princ)
)

Link to comment
Share on other sites

If you look into writing a script its pretty do able, just open master dwg it writes the xy to a txt file open second dwg via script block is inserted, you can do stuff like jump between dwgs code is it a bit more complex. A script can run multiple lisps one after each other.

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