Jump to content

Entmake scale problem


Recommended Posts

Posted (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 by lastknownuser
Posted

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).

Posted
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

Posted

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

Posted
(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.

  • Like 1
Posted

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

 

 

  • Like 1

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...