loveboatcaptain 发表于 2022-7-5 23:38:56

Create & Insert block - by gr

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?

pefi 发表于 2022-7-6 00:06:49

How far you're with the lisp?

loveboatcaptain 发表于 2022-7-6 00:22:18

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

BIGAL 发表于 2022-7-6 00:45:11

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.
页: [1]
查看完整版本: Create & Insert block - by gr