Attribute alignment issue

Attribute alignment issue

DGRL
Advisor Advisor
2,668 Views
12 Replies
Message 1 of 13

Attribute alignment issue

DGRL
Advisor
Advisor

Dear coders

 

Using lisp I place Attributes inside a block

Accept 1 thing all it working fine

The alignment does not want to update correctly

Assoc 10 and assoc 72 are coming from an entity that is being deleted afterwards ( MTEXT entity )

 

(setq assoc10 (cdr (assoc 10 atte)))
(setq assoc72 (cdr (assoc 72 atte)))
(setq attt (RemovePairs atte '( 10 72 )))
(setq ptt (append '( (0 . "ATTDEF") ) attt (list (cons 10 assoc10)(cons 72 assoc72))))
(entmod ptt)

 

 

Remove pairs is a function to remove the Assoc pair you like ( in this case I remove ASSOC 10 and ASSOC 72 and append them later with correct values )
The yellow is MTEXT and alignment is top center while the white one is the Attribute and alignment is left
The entmod is updating but for some reason the Attribute is not updating ASSOC 72

 

 

Align.PNG













 

 

 

How to fix this?

If this was of any help please kudo and/or Accept as Solution
Kind Regards
0 Likes
Accepted solutions (1)
2,669 Views
12 Replies
Replies (12)
Message 2 of 13

Kent1Cooper
Consultant
Consultant

If the Attribute is [plain] Text ["Multiple lines" item not checked in defining it], its justification is a combination  of (assoc 72) & (assoc 74) values.  [A little unexpected -- I'm glad I checked -- because in Text per se, it's 72 & 73.]  You would have to deal with both of them, and probably also with the relationship between the (assoc 10) & (assoc 11) values, which differs in Left-justified [always (11 . 0.0), with 10 being the insertion point] from all other justifications [11 is the insertion point, 10 is the left end of the base line], i.e. 10 is always the left end of the base line, regardless of justification, and that is the same as the insertion point only for Left-justified Text.

 

If you make a bunch of Attributes or plain-Text objects at the various justifications, you can compare those values for the different justifications, and figure out what you need to replace.  Or you may find it easier to use the VLA Properties -- Alignment, InsertionPoint & TextAlignmentPoint.

Kent Cooper, AIA
Message 3 of 13

DGRL
Advisor
Advisor

Hi @Kent1Cooper

 

Thanks for this info though I cant find ASSOC 74 in my MTEXT object
The MTEXT is my basis for justification so I need to get all the info from there

 

Do you know which assoc's I need to read from the MTEXT?

I only have this issue with MTEXT not with TEXT

 

off course I can explode all the MTEXT inside the block but it is more expensive so Im seeking for a shortcut and just read the MTEXT

 

 

If this was of any help please kudo and/or Accept as Solution
Kind Regards
0 Likes
Message 4 of 13

Kent1Cooper
Consultant
Consultant

@DGRL wrote:

.... 

Thanks for this info though I cant find ASSOC 74 in my MTEXT object
.... 

Do you know which assoc's I need to read from the MTEXT?

.... 


74 is part of the justification of Attribute definitions.  For Mtext, if that's your source, no, you won't find a 74 value -- justification is in the (assoc 71) value.  From the DXF Reference for Mtext:

MtextAttachment.PNG

 

For application to Attribute definitions, you need to assign both of the following from the DXF Reference for Text [going into the Reference for AttDefs  just refers you to this for the values, but what's under 73 here goes into the 74  entry in AttDefs, for some reason]:

 

JustHoriz.PNG

JustVert.PNG

Kent Cooper, AIA
Message 5 of 13

Kent1Cooper
Consultant
Consultant

@Kent1Cooper wrote:

If the Attribute is [plain] Text ["Multiple lines" item not checked in defining it], its justification is a combination  of (assoc 72) & (assoc 74) values.  ....


That distinction between plain and multi-line Attribute justification values turns out to be incorrect, on digging further.  There's an (assoc 70) value for whether an Attribute is multi-line or not, but unlike the difference between justification values for Text vs. Mtext  [which I wrongly assumed would also apply to the similar types of Attributes], those for both single-line and  multi-line Attributes apparently use the same  combination of two values.

Kent Cooper, AIA
Message 6 of 13

DGRL
Advisor
Advisor

HI

 

Thanks for this explanation and pointing out to the dxf references

That is very very useful to have

makes coding lot more efficient 😄

 

Have free time atm so will let you know by monday if i fixed it

Pretty sure i will lol

 

Have a very nice weekend ahead

If this was of any help please kudo and/or Accept as Solution
Kind Regards
0 Likes
Message 7 of 13

DGRL
Advisor
Advisor

hi @Kent1Cooper 

 

I have 1 last issue that I cant figure out

See the screenshot there are 2 entities

the top one is ATTRIB and the lower one is MTEXT

Both have justify TOP CENTER yet you see they are not aligned.

Do you have any idea how to get those 2 aligned?

 

I also uploaded the title block of the client I use

Its nothing more then a few MTEXT entities containing a field linked to DWGPROP

 

This same issue is for TEXT as for MTEXT

 


attmtxt.PNG

If this was of any help please kudo and/or Accept as Solution
Kind Regards
0 Likes
Message 8 of 13

Kent1Cooper
Consultant
Consultant

@DGRL wrote:

....

See the screenshot there are 2 entities

the top one is ATTRIB and the lower one is MTEXT

Both have justify TOP CENTER yet you see they are not aligned.

....


We can't see from the image whether their insertion points  are aligned.  Select both and look at whether their insertion-point grips line up.

 

Also, the Block in the drawing has Mtext objects [all of which, it seems, could be just Text], but no Attribute Definitions, so again, we can't evaluate the relationship.

Kent Cooper, AIA
0 Likes
Message 9 of 13

DGRL
Advisor
Advisor

@Kent1Cooper

 

I forgot to mention that the black line you see is attached to the alignment points (both are aligned TOP CENTER)

and for the dwg i uploaded
I have to upload a dwg tomorrow coz at home atm

As far as i know the TAG is TEKENINGNR so it is longer then the value atm


Could it be that teh aligment of Attribute is based on TAG anf not on Value?
Coz if that is the case then we know where it comes from

But if the alignment is based on Attribute TAG and not value then how can i fix this?

 

If this was of any help please kudo and/or Accept as Solution
Kind Regards
0 Likes
Message 10 of 13

john.uhden
Mentor
Mentor

Those 70 codes get very confusing, especially since text and mtext use them differently.

Have you tried using vla properties instead?

John F. Uhden

Message 11 of 13

DGRL
Advisor
Advisor

@john.uhden

 

Thanks for the reply

No I did not tried that yet but will look into it
Still learning about vla / vlax ect

 

If this was of any help please kudo and/or Accept as Solution
Kind Regards
0 Likes
Message 12 of 13

DGRL
Advisor
Advisor

@john.uhden and @Kent1Cooper

 

For me as a noob this is a big thing LOL

I fixed it guys

Needed to tweak Assoc 72 of the Attrib in order to get it working


But when I open the block the attributes are still misaligned

This is only in block editor

So will see how to fix this
Almost there

 

 

 

Issues Solved

Kudo's for you guys

 

If this was of any help please kudo and/or Accept as Solution
Kind Regards
0 Likes
Message 13 of 13

DGRL
Advisor
Advisor
Accepted solution

@john.uhden and @Kent1Cooper

 

 

I fixed it for sure now

Trick is not to fill in value in the AcDbAttributeDefinition but only in the AcDbBlockReference

 

Issue solved
Thanks guys

 

If this was of any help please kudo and/or Accept as Solution
Kind Regards
0 Likes