location/ justify block attributes

location/ justify block attributes

sander.van.pelt
Advocate Advocate
1,242 Views
12 Replies
Message 1 of 13

location/ justify block attributes

sander.van.pelt
Advocate
Advocate

Hello everybody,

I have to constantly move and align the locations of all the attributes many, many different blocks because otherwise they are hard to read.
Sometimes on the left, sometimes on the top, bottom or, as shown in the picture, on the right.

Is there a possibility/is there a (combination of) lisp(s) to place all the attributes, at the same distance from each other, on top of each other, choose the side of the block where they should be placed and justify the attributes based on where they are?
If the attributes are above, on the right or below the block, they may be justified on the left. If they are on the left side of the block, it must be right aligned.

The order in which the attributes should be is the same as they are listed in the BATTMAN.
So the same as on the right side.

If anyone can help me, I'd love to hear it.


If someone could already help me to align the attributes or just change all justify properties of all attributes at once, that's also welcome.

 

Thanks

order attributes.png

0 Likes
1,243 Views
12 Replies
Replies (12)
Message 2 of 13

ВeekeeCZ
Consultant
Consultant

Possibly THIS tool could help.

0 Likes
Message 3 of 13

Sea-Haven
Mentor
Mentor

In bedit make 1 attribute and copy down a set distance F8 on, drag with mouse enter distance, then use properties to change tag name in particular.

 

SeaHaven_0-1669625721032.png

 

0 Likes
Message 4 of 13

maxwell.zarpentine
Observer
Observer

Have you made any progress on this? I am also looking for something to do the same.

0 Likes
Message 5 of 13

sander.van.pelt
Advocate
Advocate

Thank you (again) BeekeeCZ,
This already helps me for part of what I want

0 Likes
Message 6 of 13

sander.van.pelt
Advocate
Advocate

I can not edit the blocks. We use a program called "StabiCad" which created for AutoCad. 

With the help of this program I draw mechanical installations, such as air ducts, air vents, water pipes, sewer pipes and heating. All Heating, Ventilation, Air Conditioning (HVAC) installations. Every object I place is a block with connectors.
And all the names of these blocks start with *U followed by a number.

They are not visible in the "Block Edit Definition" window.

If I place an air grille, which is also visible in the image, I can first set these attributes correctly and then copy them. That's no problem.
But suppose this is an air grille with a 200mm connection. Then I only have to select the connector and I can draw automatically an air duct of 200mm. By double-clicking on the grille I can adjust the manufacturer, model, dimensions and diameters of the connections. If I change just one thing, all attributes jump again. And I need to replace those again.

0 Likes
Message 7 of 13

ВeekeeCZ
Consultant
Consultant

*

0 Likes
Message 8 of 13

Sea-Haven
Mentor
Mentor

blocks start with *U followed by a number.

 

This means they are probably dynamic blocks, they have a property called effective name so you can get at the original block using bedit. Edit the attribute location then Attsync.

 

Can you post a dwg with a few blocks so we can look at them a bit deeper and do some testing.

 

Using dumpit you can see "effective name"

;;;===================================================================; 
;;; DumpIt                                                            ; 
;;;-------------------------------------------------------------------; 
;;; Dump all methods and properties for selected objects              ; 
;;;===================================================================; 
(defun C:Dumpit ( / ent) 
  (while (setq ent (entsel)) 
    (vlax-Dump-Object 
      (vlax-Ename->Vla-Object (car ent)) 
    ) 
  ) 
  (princ) 
)
0 Likes
Message 9 of 13

maxwell.zarpentine
Observer
Observer

I have a similar issue to the original request that I am trying to move the attributes as one, justify them depending on which side of the insertion point they are, then align them as shown in the images below.

 

maxwellzarpentine_0-1672776489015.png   

maxwellzarpentine_2-1672776670965.png

 

 

 

0 Likes
Message 10 of 13

Sea-Haven
Mentor
Mentor

Yes can be done, not sure how much you want to move or do you want like 4 answers ? L R T B.

 

(setq obj (vlax-ename->vla-object (car  (entsel "Pick block obj"))))
(setq atts (vlax-invoke obj 'Getattributes))
; an example of getting or putting the attributes
(setq pt (vlax-get (car atts) 'TextAlignmentPoint))
(-0.5 1.0 0.0)
; so put new value of attribute tetx point
(vla-put-TextAlignmentPoint (car atts) (vlax-3d-point '(-1.5 2. 0.)))
; as you have multiple atts use nth, 0 is 1st attribute
(vla-put-TextAlignmentPoint (nth 0 atts) (vlax-3d-point '(-1.5 2. 0.)))
; this is usefull when moving points a distance in X and Y set y 0.0 for x only
(setq pt2 (mapcar '+ pt (list X Y 0.0)))
(vla-put-TextAlignmentPoint (nth 0 atts) (vlax-3d-point pt2))

 

0 Likes
Message 11 of 13

maxwell.zarpentine
Observer
Observer

This is what I get with the program you provided.

 

maxwellzarpentine_0-1672793047350.png

 

 

0 Likes
Message 12 of 13

Sea-Haven
Mentor
Mentor

Its not the answer just sample code about how to get text position from your block and change it. You have not supplied what you want to do and the offsets required, ie final result TOP BOT LEFT or RIGHT may be the choices.

0 Likes
Message 13 of 13

ВeekeeCZ
Consultant
Consultant

Is it really that bad? See THIS  (not sure whether that feature still works, so added a video too)

 

0 Likes