TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: w64bit on July 27, 2020, 06:52:19 AM

Title: Update lineweight property
Post by: w64bit on July 27, 2020, 06:52:19 AM
In a lisp I found for changing content of blocks to:
- layer 0
- color ByBlock
I need to add the code for changing also the lineweight to ByLayer.
Tried to change 6 to 370 in the following part, but with no luck:
Code: [Select]
        (if (assoc 6 lSubData)
          (progn
            (setq lSubData
                   (subst
                     (cons 6 "BYBLOCK")
                     (assoc 6 lSubData)
                     lSubData
                   ) ;_ end subst
            ) ;_ end setq
            (entmod lSubData)
          ) ;_ end progn
          (entmod (append lSubData (list (cons 6 "BYBLOCK"))))
        ) ;_ end if
Can anyone help?
Title: Re: Update lineweight property
Post by: d2010 on July 27, 2020, 09:50:10 AM
Can anyone help?
Can you test this program? You execute with command BYL[enter] at line command.
My programe autoxchw.lsp Change to BYLayer , all entities inside Blocsk.I do not have Drawing.dwg with Blocks + manycolors-inside
Title: Re: Update lineweight property
Post by: ribarm on July 27, 2020, 09:56:40 AM
If you want to set Lineweight to ByLayer, you should set DXF 370 to -1...
If you want ByBlock => (370 . -2)
If you want Default => (370 . -3)
And if you want millimeters => (370 . x) and x=(0 5 9 13 15 18 20 25 30 35 40 50 53 60  70 80 90 100 106 120 140 158 200 211)

Note - once added DXF 370, can't be removed like '(66 . 1) - block with attributes, so if not present I'd leave DXF data unchanged, but if (assoc 370 (entget ent)) => (entupd (cdr (assoc -1 (entmod (subst '(370 . x) (assoc 370 (entget ent)) (entget ent))))))
x - you'll have to choose...

[EDIT : I was wrong for my note... I've changed lineweight to some value, then (entupd (cdr (assoc -1 (entmod (subst '(370 . -1) (assoc 370 (entget ent)) (entget ent)))))) and miraculously DXF 370 disappeared...]
Title: Re: Update lineweight property
Post by: w64bit on July 27, 2020, 11:42:13 AM
Thank you all very much.