lastknownuser Posted September 15 Share Posted September 15 (edited) Need help with entmake. I want to create block with ATTRIB that has uniform scale 0.5. I add the code 41 0.5 (Scale X), but can't add 42 or 43 (Scale Y and Z). So when I create block with entmake, X scale is 0.5, but its always 1 in Y and Z directions. How can I edit those too, to be the same value like X scale (so its uniform scaling). Edited September 15 by lastknownuser Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 15 Share Posted September 15 It's difficult to advise without seeing your code. Generally, when inserting an attributed block, it's easier to use the ActiveX insertblock method (which will automatically create/position/orient/rotate/scale the associated attributes) than using entmake (for which you have to entmake the associated ATTRIB entities). Quote Link to comment Share on other sites More sharing options...
lastknownuser Posted September 15 Author Share Posted September 15 7 minutes ago, Lee Mac said: It's difficult to advise without seeing your code. Generally, when inserting an attributed block, it's easier to use the ActiveX insertblock method (which will automatically create/position/orient/rotate/scale the associated attributes) than using entmake (for which you have to entmake the associated ATTRIB entities). Couldn't find any information how to use vla-insertblock, is there some examples and explanation online? And I solved my problem already... I just had to add codes 41, 42, 43 to INSERT only, not to ATTRIB. Works okay now it seems Quote Link to comment Share on other sites More sharing options...
dexus Posted September 15 Share Posted September 15 If you type it into google, the first link has an example program: https://www.afralisp.net/archive/methods/lista/insertblock_method.htm Quote Link to comment Share on other sites More sharing options...
lastknownuser Posted September 15 Author Share Posted September 15 8 minutes ago, dexus said: If you type it into google, the first link has an example program: https://www.afralisp.net/archive/methods/lista/insertblock_method.htm Thanks but I saw that and few other links... I didn't find anywhere how to insert attribute definitions using it, which was the point of my question Quote Link to comment Share on other sites More sharing options...
lastknownuser Posted September 15 Author Share Posted September 15 I believe I found out how to do it using vla-insertblock (setq thisdrawing (vla-get-activedocument (vlax-get-acad-object))) (setq mspace (vla-get-modelspace thisdrawing)) (setq pt1 (getpoint)) (setq blk (vla-insertBlock mspace (vlax-3d-point pt1) "block" 1.0 1.0 1.0 0)) (setq att (car (vlax-safearray->list (vlax-variant-value (vla-getattributes blk))))) (vla-put-textstring att "test") It seems easier, simpler yes, but is it faster than entmake if someone can answer? I'll do some speed tests for sure but don't have the time now Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 15 Share Posted September 15 (if (setq ins (getpoint "\nSpecify insertion point: ")) (progn (setq blk (vla-insertblock (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))) (vlax-3D-point (trans ins 1 0)) "block" 1 1 1 0)) (vla-put-textstring (car (vlax-invoke blk 'getattributes)) "test") ) ) Note that you can avoid the conversion from variants & safearrays to native LISP data types by leveraging vlax-invoke/vlax-get. 1 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 15 Share Posted September 15 If more than 1 attribute say 2 (vla-put-textstring (car (vlax-invoke blk 'getattributes)) "test") (setq atts (vlax-invoke blk 'getattributes)) (vla-put-textstring (nth 0 atts) "Test1") ; can use (car atts) (vla-put-textstring (nth 1 atts) "Test2") ; can use (cadr atts) ; for multi atts find easier to use nth method 1 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.