itacad Posted May 28, 2018 Share Posted May 28, 2018 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 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 29, 2018 Share Posted May 29, 2018 (edited) 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 May 29, 2018 by BIGAL Quote Link to comment Share on other sites More sharing options...
itacad Posted May 30, 2018 Author Share Posted May 30, 2018 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. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 31, 2018 Share Posted May 31, 2018 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.