vla-put-AttachmentPoint

vla-put-AttachmentPoint

dvertz
Collaborator Collaborator
769 Views
6 Replies
Message 1 of 7

vla-put-AttachmentPoint

dvertz
Collaborator
Collaborator

Once again, I'm stuck.

I am trying to set the justification on MTEXT.

 

So I created the mtext with "vla-AddMtext" and assigned it to the variable "VLA:OBJECT".

Then I assign (setq INT:JUSTIFY 5)

But using this code "(vla-put-AttachmentPoint VLA:OBJECT INT:JUSTIFY)" I get "; error: ActiveX Server returned the error: unknown name: AttachmentPoint".

 

According to the help file at: https://help.autodesk.com/view/OARX/2023/ENU/?guid=GUID-FD7EDA56-7FA0-4616-A746-9B97AE0C6456

"AttachmentPoint" is the correct name for the property.

 

So I did a "(dumpallproperties (car (entsel)))" and this returns "Attachment (type: AcDbMText::AttachmentPoint) (LocalName: Justify) = 1".

 

So, if I assume that "Attachment" is really the correct property and use "(vla-put-Attachment VLA:OBJECT INT:JUSTIFY)" then I get "; error: no function definition: VLA-PUT-ATTACHMENT".

 

So, how do I "put" the justification on MTEXT?

Civil 3D 2022,
Windows 10 Pro, x64, Nvidia Quadro P1000
Intel Core i9-11900k; 3.50GHz, 32 GB RAM, 500GB WD BLACK M.2


0 Likes
Accepted solutions (1)
770 Views
6 Replies
Replies (6)
Message 2 of 7

komondormrex
Mentor
Mentor

try that way

(vla-put-attachmentpoint VLA:OBJECT  INT:JUSTIFY)

0 Likes
Message 3 of 7

dvertz
Collaborator
Collaborator

Thanks for the suggestion. The only difference I saw was capitalization. I was sure that wouldn't be the issue, but I tried it anyway. It responds with the exact same error (capitalization and all).

Civil 3D 2022,
Windows 10 Pro, x64, Nvidia Quadro P1000
Intel Core i9-11900k; 3.50GHz, 32 GB RAM, 500GB WD BLACK M.2


0 Likes
Message 4 of 7

Moshe-A
Mentor
Mentor

@dvertz hi,

 

Make sure you do not have any restrictions for that mtext like you putting it on locked layer?!

i give it a try (on R2022) on model space and it worked also inside a block and it worked.

 

Moshe

 

0 Likes
Message 5 of 7

komondormrex
Mentor
Mentor

capitalization has no difference, but consider attachment vs attachmentpoint.

0 Likes
Message 6 of 7

paullimapa
Mentor
Mentor
Accepted solution

don't mix vl obj terms with lisp terms...sometimes they're the same other times they're not

for example use the following method to get vl dump:

(vlax-dump-object (setq obj (vlax-ename->vla-object (car(entsel)))))

Then the following should return current setting:

(vla-get-attachmentpoint obj)

 To change use what you've shown:

(vla-put-attachmentpoint obj 5)

Then the lisp dump method is as you've shown:

(dumpallproperties (setq en(car(entsel))))

Then use the following to get the value:

(getpropertyvalue en "attachment")

Then the following to set the value:

(setpropertyvalue en "attachment" 5)

Supported values for MTEXT are:

 1 = acTopLeft 2 = acTopCenter 3 = acTopRight
 4 = acMiddleLeft 5 = acMiddleCenter 6 = acMiddleRight
 7 = acBottomLeft 8 = acBottomCenter 9 = acBottomRight


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 7 of 7

Kent1Cooper
Consultant
Consultant

@dvertz wrote:

....

Then I assign (setq INT:JUSTIFY 5)

But using this code "(vla-put-AttachmentPoint VLA:OBJECT INT:JUSTIFY)" I get "; error: ActiveX Server returned the error: unknown name: AttachmentPoint". ....


That format works for me.  So does this, which you might try instead:

(vlax-put-property VLA:OBJECT 'attachmentpoint INT:JUSTIFY)

If that doesn't work either, I don't know what to suggest.  The locked-layer possibility can't be it, because if that's the problem, the error message is specific about it.

Kent Cooper, AIA
0 Likes