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

adapt group with larger closed polylinee size and surface texts with just one click (multiple selection)

  • Thread starter Thread starter Mano63
  • Start date Start date

Mano63

Guest
Good morning to all,
I created a block (named post2021, v. attached) with constraints that works this way (see pictures below):
operation "a" - selecting the block is highlighted the top right, drags to the corresponding vertex of the largest polyline (always on the top right) and the block adapts to the size of the larger polylinea (saving the texts consist of data fields that report size and surface).in practice, having planes with hundreds of polylines:
1 - with a lisp I introduce the post2021 block in the geometric center of every polyline that populates my planimetry (command that introduces the block in all polylines with a single selection)
2 - I repeat the operation "a" for each polyline contained in the design

I ask your help to succeed (with a lisp of your creation) to perform adaptations with a single operation.
I think useful, once the blocks are inserted (point 1) explode them all with special lisp (of which I have) in groups. groups are bound so that all elements "follow the movement of the polylinea contained in them.
the command that I ask you should make so that the four vertices of the inner polylinea to the group go superimposed to the four vertices of the largest polylinea (vertice of the polylinea of the group with summit of the larger polylinea closer). the other elements of the group will follow the polyline of the group itself.

simple concept, perhaps more complex explanation... If someone understood and wants to try to help me I thank him in advance.

1634983020236.webp
1634985237854.webp
 

Attachments

insert blocks, turn them into groups and Then Try this lisp.
with all those constraints the operation is very slow, so I have foreseen the selection of rectangles to be treated, but you can always type t (all) at the request of selection objects.
a single lisp starting from the insertion of the blocks would give faster results as at each insert you would already know the identifiers of the rectangle and the block inserted, while now the routine searches all the polylines closed on the "track" layer and then searches within each if there are closed polylines (so the blocks must already be exploded) on the "post" layer.
I hope it works because the time to adapt it is missing.
Code:
(defun c:test ( / poly r1 r2 p_or v_r1 v_r2 p_dest )
(setq pks (getvar 'pickstyle))
(setvar 'pickstyle 0)
(princ "\selezionare and rettangoli da trattare")
(setq poly (ssget '(0 . "lwpolyline") (8 . "traccia") (-4 . "&=") (70 . 1))))
(repeat (ssslength poly)
(setq r2 (ssname poly (setq n (1-n)))))
(setq v_r2 (map 'cdr (vl-remove-if-not '(lambda ( x ) (= 10 (car x)))))
(setq r1 (ssget "_wp" v_r2 '((0 . "lwpolyline") (8 . "post") (-4 . "&=") (70 . 1))))
(if (and r1 (= 1)
(progn)
(setq r1 (ssname r1 0))
(setq v_r1 (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= 10 (car x)))))
(setq p_or (cadr v_r1))
(setq p_dest
(car
(vl-sort v_r2
lambda (x1 x2)
(<
(distance p_or (list (car x1)
(distance p_or (list (car x2)
)
)
)
)
)
(entmod (subst 10 p_dest) (cons 10 p_or) (entget r1))
)
)
)
(setvar 'pickstyle pks)
(princ)
)
 
thanks gp.!!
do I have to select groups or polylines within them?
... I'm leaving this message:1635143323310.webp
 
Sorry, gp.
Now I understand.. I have to select the rectangles to which groups must adapt. trying with 3 rectangles the command works perfectly on 2:1635144384628.webp.. now I try on a greater amount. . .

Thanks again!
 
. .selecting a greater amount works anyway on all except 1, but little matter, the big is done!1635145771635.webpThank you 1000!
 

Attachments

  • 1635145714945.webp
    1635145714945.webp
    44.6 KB · Views: 1
boh, I don't know why on a rectangle (which then is the first that the lisp process) doesn't work.
At the end, you return the command and try to re-check only that.
 
That's okay. the real problem, at the bottom, are all those blocks/groups each with 27 constraints. for a planimetry with 160 rectangles max 15 min (and I would say it is okay - my colleagues not less than 2 h!).. I have all the time for coffee, don't you think?
Thank you.
Mar
 

Forum statistics

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

Members online

No members online now.
Back
Top