Jump to content

Attributes length and width factor


itacad

Recommended Posts

Hi, a block has attributes, these attributes are automatically compiled by an application.

It is impossible to know a priori the number of characters of the string that will be inserted in the attributes, but it is possible to know in advance the maximum length that each attribute should have in order not to exceed the graphic limits that you do not want to exceed for aesthetic reasons.

Is it possible to make the width factor proportionally decrease only after a certain number of characters so that the maximum autocad unit length desired for the attribute is not exceeded?

Regards

Link to comment
Share on other sites

Yes it is possible just the variable name is a little obscure. "Scalefactor"

(setq obj (vlax-ename->vla-object (car (entsel))))
(foreach att (vlax-invoke obj 'getattributes)
       (if (= "DRAWING_STATUS" (strcase (vla-get-tagstring att)))
       (vla-put-scalefactor att 0.75)  ; change value as a factor of your strlen
       )
)

Edited by BIGAL
Link to comment
Share on other sites

Sorry but I don't understand how the code works...I tried it but I have not seen changes...I click above an attribute and the result is "nil"...

I would like the solution not to be realized by a lisp because every attribute has got a specific "maximum useful length".

The blocks are saved as individual files ready to be inserted into the various designs and the attribute justification is set to "fit", that is the effect I want to achieve but only after passing a certain number of characters, a specific lenght...

I apologize for the probably confused explanation.

Link to comment
Share on other sites

In the example code above I pick a block "entsel"

then I get all the attributes and look at each one individually "att"

I look at the name of the attribute tag string "DRAWING_STATUS" if its the one I want to check then change the "width".

The 0.75 was a random number I chose for testing, say 10 characters max I have twenty so I would use a scalefactor of 0.5

 

 

Version 1 reading post again you need to insert the block say 1st then edit the scalefactor for the correct tag.

Version 2 you are creating the block from scratch then you could define the scalefactor for a particular attribute as part of say entmake.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...