View Full Version : block properties command for lisp
dadasl
26th Aug 2005, 04:11 am
Hi~ does anyone know what the block properties command is? I was trying to change the geometry properties of the block using lisp, without the dialog window. I've tried the CH command, but it only works for color, layer etc.
does anyone one knows?
hendie
26th Aug 2005, 08:04 am
if you mean what I think you mean, you cannot change the geometric properties of a block without redefining it.
Either redefine and reinsert, or use refedit
fixo
26th Aug 2005, 08:22 am
Hi~ does anyone know what the block properties command is? I was trying to change the geometry properties of the block using lisp, without the dialog window. I've tried the CH command, but it only works for color, layer etc.
does anyone one knows?
Hi, dadasl!
See this example maybe it helps to you
This routine add one vertex with coord's '(20.0 10.0)
to lwpolyline subentity and change color on yellow
(defun C:demo (/ blist blk_ent elist nen sub_ent)
(setq nen (nentsel "\nSelect rectang in block")
sub_ent (car nen)
elist (entget sub_ent)
blk_ent (car (cadddr nen))
blist (entget blk_ent)
)
(setq elist
(append
(reverse (cdr (reverse elist)))
(list
'(10 20.0 10.0) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0)
'(210 0.0 0.0 1.0))
)
elist (subst (cons 90 5) (assoc 90 elist) elist)
)
(if (null (assoc 62 elist))
(setq elist (append elist (list (cons 62 2))))
(setq elist (subst (cons 62 2) (assoc 62 elist) elist))
)
(entmod elist)
(entupd sub_ent)
(entupd blk_ent)
(princ)
)
Thak you
Fatty
dadasl
26th Aug 2005, 07:09 pm
Thnx for all the reply~
but what i meant was, after you make the block, u can use the properties windows to change the geometry properties of the block, rite? One of the useful geometry properties you can change is the x/y/z scale, which means you can change the scale of the block in only one direction without reinserting the block again. What i need is to use a autoLISP command to make these changes without using the properties window. Is there any command for modifying the block properties(geometric properties--x/y/z scales) without using the dialog windows?
fixo
27th Aug 2005, 12:00 am
Thnx for all the reply~
but what i meant was, after you make the block, u can use the properties windows to change the geometry properties of the block, rite? One of the useful geometry properties you can change is the x/y/z scale, which means you can change the scale of the block in only one direction without reinserting the block again. What i need is to use a autoLISP command to make these changes without using the properties window. Is there any command for modifying the block properties(geometric properties--x/y/z scales) without using the dialog windows?
Hi again, dadasl
If you need to modify the whole blocks but not subentities,
you can try this routine
Thank you
(defun c:ibx (/ attd blk bname cmde elist osmd p1 xsc ysc zsc)
(setq cmde (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq osmd (getvar "osmode"))
(setvar "osmode" 0)
(setq attd (getvar "attreq"))
(setvar "attreq" 0)
(setq blk (car (entsel "\nSelect block:")))
(if blk
(progn
(setq elist (entget blk)
bname (cdr (assoc 2 elist))
p1 (cdr (assoc 10 elist))
xsc (getdist "\nEnter X-scale: \n")
ysc (getdist "\nEnter Y-scale: \n")
zsc (getdist "\nEnter Z-scale: \n")
)
(command "-insert" bname "X" xsc "Y" ysc "Z" zsc p1 0.0)
(command "erase" blk "")
(command "regenall")
)
)
(setvar "cmdecho" cmde)
(setvar "osmode" osmd)
(setvar "attreq" attd)
(princ)
)
dadasl
28th Aug 2005, 01:17 am
thnx a lot fatty~ seems the only way to do this is to delete and reinsert it after all.
Powered by vBulletin™ Version 4.1.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.