Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Attribute's lineweight within blocks

3 REPLIES 3
Reply
Message 1 of 4
adiaz
244 Views, 3 Replies

Attribute's lineweight within blocks

I am trying to modify attribute's lineweight with hard coded colors based on an existing CTB. I am creating a selection set and processing only those attributes with code 62 present. I having trouble getting code 370 for the attributes. This code (setq eLwt (cdr (assoc 370 eList)) returns nil and the entmod don't do anything. I know code 370 will return -1 for ByLayer, -2 for ByBlock and -3 for Default. What I am doing wrong? Is the 370 code accessible through Autolisp or do I need to use Vlisp to access it?. Any help will be appreciated. Here is part of the code:

(defun C:ChgAttLW (/ ss sslen ct blk ent eList)
(setq ss (ssget "x" '((0 . "INSERT")))
ct 0
sslen (sslength ss)
)
(while (< ct sslen)
(setq blk (ssname ss ct)
ent (entnext blk)
eList (entget ent)
)
(while (and ent (= (cdr (assoc 0 eList)) "ATTRIB"))
(if (assoc 62 eList)
(progn
(setq eClr (cdr (assoc 62 eList))
eLwt (cdr (assoc 370 eList))
)
(GetClrLW)
(setq eList (entmod (subst (cons 370 LinW) (cons 370 eLwt) eList)))
)
)
(entupd ent)
(setq ent (entnext ent))
(setq eList (entget ent))
)
(setq ct (1+ ct))
)
(princ)
)

Alex
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: adiaz

(setq Sel (nentsel "\n Select attribute entity: "))
(setq EntData (entget (car Sel)))
(setq EntData (subst (cons 370 -1) (assoc 370 EntData) EntData))
(entmod EntData)
(entupd (cdr (assoc -1 EntData)))

The above worked for me, but I noticed that once it was changed to '-1' the
dxf code isn't there anymore, so you would have to use the 'append' function
to add it. That may be your problem.

--

Tim
"A blind man lets nothing block his vision."


wrote in message news:5414400@discussion.autodesk.com...
I am trying to modify attribute's lineweight with hard coded colors based on
an existing CTB. I am creating a selection set and processing only those
attributes with code 62 present. I having trouble getting code 370 for the
attributes. This code (setq eLwt (cdr (assoc 370 eList)) returns nil and the
entmod don't do anything. I know code 370 will return -1 for ByLayer, -2 for
ByBlock and -3 for Default. What I am doing wrong? Is the 370 code
accessible through Autolisp or do I need to use Vlisp to access it?. Any
help will be appreciated. Here is part of the code:

(defun C:ChgAttLW (/ ss sslen ct blk ent eList)
(setq ss (ssget "x" '((0 . "INSERT")))
ct 0
sslen (sslength ss)
)
(while (< ct sslen)
(setq blk (ssname ss ct)
ent (entnext blk)
eList (entget ent)
)
(while (and ent (= (cdr (assoc 0 eList)) "ATTRIB"))
(if (assoc 62 eList)
(progn
(setq eClr (cdr (assoc 62 eList))
eLwt (cdr (assoc 370 eList))
)
(GetClrLW)
(setq eList (entmod (subst (cons 370 LinW) (cons 370 eLwt) eList)))
)
)
(entupd ent)
(setq ent (entnext ent))
(setq eList (entget ent))
)
(setq ct (1+ ct))
)
(princ)
)

Alex
Message 3 of 4
adiaz
in reply to: adiaz

Tim,

I tried 'append' with no luck. The attribute definitions within the blocks were created with properties set to ByBlock. If the color of the attribute was overridden with 'attedit', eattedit', or 'battman' and tried to get code 370, it returns 'nil'. Entmod and append didn't work neither. Any other idea.? Thanks

Alex
Message 4 of 4
Anonymous
in reply to: adiaz

Alex,

If the lisp way isn't working, have you tried the ActiveX way? With
ActiveX there will always be a 'LineWeight' property which you could change.

--

Tim
"A blind man lets nothing block his vision."


wrote in message news:5415291@discussion.autodesk.com...
Tim,

I tried 'append' with no luck. The attribute definitions within the blocks
were created with properties set to ByBlock. If the color of the attribute
was overridden with 'attedit', eattedit', or 'battman' and tried to get code
370, it returns 'nil'. Entmod and append didn't work neither. Any other
idea.? Thanks

Alex

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost