Jump to content

Set MLEADER ArrowSymbol by lisp


Aftertouch

Recommended Posts

Hello everybody,

 

When i create a new style using LISP.

How can i change the ArrowHead symbol to 'Box'?

 

code below should work... but it doesnt. 😞


    (setq newleaderstyle (vla-AddObject (vla-item (vla-get-Dictionaries (vla-get-ActiveDocument (vlax-get-acad-object))) "ACAD_MLEADERSTYLE") "TEST" "AcDbMLeaderStyle"))

(vla-put-ArrowSymbol newleaderstyle "_BoxFilled")

 

 

image.png.8aaac54d8998855c8aace298d0b83f8d.png

Link to comment
Share on other sites

Alright... So... i first need to load it in the DWG, before i can set it?

Where are the default 'dim blocks' stored?

How can i insert the original in my DWG?

 

Link to comment
Share on other sites

When i manualy changed the arrow types, the original blocks got inserted in the DWG.

I WBLOCK'ed all these blocks to my own trusted folder.

Now i can insert the blockdefinition, before setting the ArrowSymbol to the correct blockname/symbolname.

 

Thanks for the head up Roy_043

Link to comment
Share on other sites

@BIGAL,

 

Hi Bigal,

 

Yes they are present in the pulldown menu in the DWT. But they are not shown in the 'INSERT' command by default.

Only when i select one of those arrowheads, there definition is added to the 'INSERT' menu, wich means that only at THAT point, the block is present in the DWG.

So.. it has be inserted from an external source?

 

When i create a new MLEADERSTYLE by LISP, i cannot set the arrowhead since it cannot find that block in the DWG.

When i first create a mleader in the 'Standard' style, and change the arrowhead manualy... THEN i can set the arrowhead by LISP.

 

I added a video to my post, to explain the problem...

I hope it makes any sense. 🙂

Link to comment
Share on other sites

I think the same.

Anyone knows where there definitions are stored? Even when generated when required.... the source must be somewhere...

Edited by Aftertouch
Link to comment
Share on other sites

What about: (vla-put-ArrowheadType <leader object> acArrowBoxFilled)?

 

EDIT: Changed above from "acArrowDefault" to "acArrowBoxFilled" per the original request.

 

If you want to see the rest of the arrow head enums (type options), search for "ArrowheadType Property (ActiveX)" in AutoCAD help.

 

OK - sorry. I see now the ArrowHeadType properly does not exist in MleaderStyle objects.

Edited by pkenewell
Link to comment
Share on other sites

Quick test and setting the DIMBLK variable as pointed out by @eldon imports the appropriate block. Maybe something like this:

(defun _importarrowheadblock (n)
  (or (tblobjname "block" n) (= 'str (type (vl-catch-all-apply 'setvar (list "DIMBLK" n)))))
)
(if (_importarrowheadblock "_BOXFILLED")
  (vla-put-arrowsymbol newleaderstyle "_BOXFILLED")
)

 

  • Like 2
  • Funny 1
Link to comment
Share on other sites

3 minutes ago, BIGAL said:

I could be wrong but I seem to recall using a number to set arrow type will look into VL dump properties.

The block still needs to be defined from my testing.

Link to comment
Share on other sites

Yeah found it to change a pre created.

 

(setq obj (vlax-ename->vla-object (car (entsel "pick object "))))
(VLA-PUT-ARROWHEAD OBJ X) ; default is x=0 tick = 5

For a dimension  Arrowhead1Type = 0,  Arrowhead2Type = 0

 

image.png.7aae4ff4f17ec7b4b9cd85c1b8d0f46b.png

 

Edited by BIGAL
Link to comment
Share on other sites

BIGAL - see my strikethrough post above. The OP is talking about setting the Arrowhead Type in an MLEADERSTYLE. The MleaderStyle object does not have the same properties. See "MleaderStyle Object (ActiveX)" in AutoCAD Help. Then click on the property "ArrowSymbol" and you will see what they are talking about. If the actual "_BOXFILLED" ArrowHead Block gets purged from the drawing, it will give an error if you try to set it to "_BoxFilled". As I understand it - temporarily setting the "DIMBLK" system variable to "_BOXFILLED" will re-load the block into the drawing.

 

@ronjonp Your idea is excellent. Saving that code snippet for my library. 😀 NOTE: I imagine you can just temporarily set "DIMBLK" in the function and return it to the original value, but the block will still be loaded? Then you can use (vla-put-ArrowSymbol) to apply it to the MleaderStyle.

Edited by pkenewell
Link to comment
Share on other sites

13 hours ago, BIGAL said:

Yeah found it to change a pre created.

 


(setq obj (vlax-ename->vla-object (car (entsel "pick object "))))
(VLA-PUT-ARROWHEAD OBJ X) ; default is x=0 tick = 5

For a dimension  Arrowhead1Type = 0,  Arrowhead2Type = 0

 

image.png.7aae4ff4f17ec7b4b9cd85c1b8d0f46b.png

 

There is also this:

image.png.d7a256b34a1f9495ad7ad35d64a79fe3.png

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