- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to write a routine that lets the user select a set of objects.
This set will be converted to a block with insertionpoint 0,0,0 and then scaled from basepoint 0,0,0 with a factor 0f 0.001.
The usecase it to scale objects from millimetes to meters.
I found this code by Lee mac on a forum and i am trying to adapt it.
(defun c:obj2blk1 (/ ss bn pt i ent elist)
; Get Entities
(while (not ss)
(princ "\nSelect Objects to Convert to Blocks:")
(setq ss (ssget '((-4 . "<NOT") (0 . "INSERT,POLYLINE,VIEWPORT") (-4 . "NOT>"))))
) ;_ end while
; Get Block Name and Base Point
(while (or (not bn)
(not (snvalid bn))
) ;_ end or
(setq bn (getstring "Specify Block Name: "))
) ;_ end while
(initget 1)
(setq pt (getpoint "Specify Base Point for Block: "))
;;; Create BLOCK Header
(entmake (list (cons 0 "BLOCK") (cons 10 pt) (cons 2 bn) (cons 70 0)))
;;;STEP THRU THE SET
(setq i (sslength ss))
(while (>= i (setq i (1- i)) 0)
(setq ent (ssname ss i)
elist (entget ent)
) ;_ end setq
(entmake elist)
) ;_ end while
;;;FINISH THE BLOCK DEFINITION
(entmake (list (cons 0 "ENDBLK") (cons 8 "0")))
;;;Insert the Block & Delete Originals
(entmake (list (cons 0 "INSERT") (cons 2 bn) (cons 8 "0") (cons 10 pt)))
(command "_.ERASE" ss "")
(redraw)
(prin1)
) ;_ end defun
It seems i am not able to alter the basepoint of the block from the variable pt to just a constant 0,0.
I am also not sure if it is possible to use the inserted block in a "scale" command after this script is completed.
Solved! Go to Solution.
Link copied