• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

lisp to scale line type

  • Thread starter Thread starter Betoniera
  • Start date Start date

Betoniera

Guest
when amount of dwg designs happens, sometimes, to have type lines with scale not appropriate to my design and differentiated.
For example, some lines (point-line type) are scaled differently in the same design.
the objective is to bring all the lines to the type line = 1 scale with a program lisp.
individually it is easy using properties.
but I would like an automated procedure for the whole design: report all lines to the line type scale = 1
the ltscale variable is not good because it scales proportionally all the lines that maintain the single scaling.
I couldn't understand what variable to intervene to report all rows to the line type scale = 1
having any suggestions about this?
Thank you, hello to all
 
but excuse... if they are only lines, why not all selections and in the palette of the properties imposed the value of scale type line to 1?
 
ltscale is the scale of the general type of dwg
the linear scale of the individual entity is different, and says that the entity, starting from the general ltscale factor is multiplied by the type factor of the entity.
this value (if different from 1) is reported in group 48 of the entity, of all entities (in this regard the 2020 help is very lacking)
 
Thank you for your contributions
Bye-bye
the reason why I try to implement that procedure is that I have realized a lisp procedure of "normalization" of files imported from others.
in this normalization, I change the quotations, scales, layers and other things to adapt them to my style.
I wanted to add the normalization of the lines. That's all.

I will try to experiment with group code 48
Hi.
 
for crystal
I have tried to insert 2 tract-point lines, one with scale factor 1 and one with scale factor 3
Something curious happens: If they examine line data with scale factor 3, I find group code 48 with factor 3.
If, instead, they examine the line data with scale factor 1, the group code 48 is not written, then the command "assoc 48" to extract the scale factor goes wrong.
Is that normal? .
Hi.
 
"this value (if different from 1) is reported in group 48 of the entity"
before changing, check the presence, if (/= (cdr (assoc 48 entities) nil) then proceed to the subst.
 
rpor good morning
yesterday I tried to filter a general ssget by binding it to group 48 code, without outcome. But I think I just don't get there.
Would you have a tip?
I write (ssget "x"((48 . "*")) ) but it returns me error code.. .
 
@cristallo test with (ssget "x" (cons 0 "line") '(-4 . "/=") (cons 48 1))

However, given the purpose of beton, I would carry all the typeline = 1 without filtering any kind of entity
Code:
(setq a (ssget "_x" ))
(repeat (setq n (sslength a))
    (setpropertyvalue (ssname a (setq n (1- n))) "linetypescale" 1)
)
 
Hello everyone
I was implementing the program
- select point 1
- selection point 2
- select lines with code 48 different from 1 (setq ss1 (ssget "_c" p1 p2 ' ((0 . "line") (-4 . "/=") (48 . 1))
- cycle for each entity to change group code, regeneration, etc.

comes gp, writes 3 lines and work.
What do I say? .
good Easter to all and thanks gp.
Hello, next time.
 
comes gp, writes 3 lines and work.
What do I say? .
What do you mean? You're encapsulated in the answer of someone who had compliments from lee mac, what do we talk about it?
❖gp. Apart from that I did not imagine that I could build a filter list in ssget that way (I read it and still twist my eyes), but the serious problem is that I would not only take the lines, since group 48 is common to all entities.
I tried to use wildcards in the filtering list (help says you can do) but it always makes me mistake.. .
 
...I wouldn't just take the lines...
use of ssget to select objects with scalatypelinea different from 1(setq a (ssget "_x" (list '(0 . "*line") '(-4 . "/=") '(48 . 1)))))
Select line, polyline, lwpolyline, spline(setq a (ssget "_x" (list '(-4 . "/=") '(48 . 1)))))
Select All objects(setq a (ssget "_x" (list '(0 . "line,arc,circle,text,lwpolyline,spline,ellipse") '(-4 . "/=") '(48 . 1)))
select the objects listed

:
 
Let's talk about it:)
My knowledge comes from wandering on the forums where they write the gurus of the lisp, if I see something interesting I take notes.
Staying up SECTION:
(ssget "_+.:s:e:l" '(0 . "line"))Filter explanation:
Code:
:s allows the selection only once
+. inserted before :s compels ssget to remain in 'point' mode, similar to
that pick car to 0
Basically you select with pickbox and do not open the selection window
:and captures an object at a time via pane
selection (pickbox) and not through window
:l excludes blocked layers
_the last "visible" object added to the database
_ "underscore" launches command in English from localized versions
it is necessary with wp :s but not with x a cp i l p :e
_a all (all) as "x", but with "freeze" filter
allows you to select all objects on defrosted layers.
_b box - select all objects inside or crossing a rectangle specified by two points.
if the points are specified from right to left, box is equivalent to "crossing", otherwise to "windows"
:d duplicates, otherwise duplicates are ignored
:the neglected layers blocked
:p neglect viewport
x advanced search (full search database), if you do not provide a ssget filter select all
database entities, including entities on frozen layers and outside the visible screen.
Moreover, at the command prompt "select objects:" you can insert add, remove, cancel
Mixed type capture(ssget "_x" (list '(8 . "pippo") '(0 . "line") (cons 62 5)))
(ssget "x"(0 . "text,mtext,line,arc")(8 . "lines"))
red and yellow objects on the line layer:
(ssget "_x"((8 . "lines") (-4 . "<or") "or="" (-4="" (62="" .="" 1)="" 2)="">")
</or")>select objects on two layerspicking variable values(setq lay1 "pippo")
(setq lay2 "pluto")
(setq salt (ssget "_x" (list (cons 8 (strcat lay1 "," lay2)) (cons 0 "circle"))))knowing the names of the layers(setq a (sssget "_x" (list '(8 . "pippo,pluto") (cons 0 "circle"))))
texts starting with a and b(ssget "_x" ((0 . "text,mtext")(1 . "a*,b*")))
polilinee con archi
(ssget "_:l" '((0 . "lwpolyline") (-4 . "<>") (42 . 0.0)))
polyline without arches (ssget "_x" '(0 . "lwpolyline")(-4 . "<not")(-4 "<="" .="">"(42). 0.0)(-4 . "not>"))
</not")(-4>select objects on a point(sget pt)
select objects passing through the 'pt' point, with tolerance (0.001)(sget "_c" (mapcar ' pt '1e-3 1e-3)
select closed polylines
(ssget '((0 . "*polyline") (-4 . "&") (70 . 1)))
...and a thousand other combinations;)
 
I miss the manual!
It's in the list filters that the manual is very lacking. It tells you that you can do it, but it makes you a scraut example and closes them.
already the use of (-4 . ) is not explained, on the multiple conditions then it is lacking.
is the first time I see the use of comma in the entity group (0 . "line,block") or_o
then use (-4 . "<>) : what does it mean...? ? ?
you have nested them a -4 not open and closed (and here I understand) but the (-4 . "<>") (42 . 0.0) what is it? ? ?
Please enlighten us.

I learned the lisp on the manual (paper!!) of version 12 (not 2012.. the 12 proper).
I find the 2010 help lisp reductive compared to that of 12, that of 2020 simply basic. I mean, a regression.
 
What is it? ? ?
dxf 42 refers to the curvature of lwpolyline, if you look at an entget see that there is a value for each vertex, if it is worth 0.0 the segment is straight (not < > 0.0)
in theory you could even do otherwise without not (-4 . "=") (42 . 0.0)

I'll take it to say goodbye SALUTO.gif
 
Thank you all for your contributions
mark that by testing with the code of gp and dwg written by others, sometimes an error is generated that I did not want to investigate.
I have, however, concluded the following alternative program that I make available as an alternative to gp.
Hello everyone

; turns all rows into scale factor 1
(setq ss1 (ssget "x" ((0 . "line")))); select all lines
count 0 ;azzera counter
emax (sslength ss1) ;number
)
(while (< count emax) ; cycle for each institution
(setq en (ssname ss1 count) ;prileva entita
and (entget en) ;private data
el (assoc 48 e) ;Preleva la scala linea code 48
el1 (cons 48 1);defines the new scale (48 . 1)
and (subst el1 el ed) ; replaces the new scale
)
(entmod ed) ; regenerates entities
(setq count (1+ count)
);
 
betoniera ciao
your code, at first sight, should give you errors, because when the entity already has line scale=1 group 48 does not exist, so (setq el) should give you nil and then the subst go wrong
 
He should, yet he does not give it.
for this reason I didn't filter code 48.
in case of doubt you can add the additional filter.
Hi.
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
ciao
Back
Top