Aftertouch Posted December 10, 2019 Posted December 10, 2019 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")   Quote
Roy_043 Posted December 10, 2019 Posted December 10, 2019 (edited) https://www.cadtutor.net/forum/topic/69226-modify-existing-mleadermultileader-style-via-lisp Edited December 10, 2019 by Roy_043 Quote
Aftertouch Posted December 10, 2019 Author Posted December 10, 2019 Hello Roy, Â Your link is about arrowsize, wich i got solved already. Method doesnt seem to work for the ArrowSymbol. Quote
Roy_043 Posted December 10, 2019 Posted December 10, 2019 (edited) The "_BoxFilled" arrow symbol is a block. You have to make sure it exists in the dwg. Edited December 10, 2019 by Roy_043 Quote
Aftertouch Posted December 10, 2019 Author Posted December 10, 2019 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? Â Quote
Aftertouch Posted December 10, 2019 Author Posted December 10, 2019 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 Quote
BIGAL Posted December 10, 2019 Posted December 10, 2019 The default arrow heads are in a dwg unless some one has gone through and removed them and saved a new dwt. Open a default Autocad DWT and dimstyle look at arrows. Â Quote
Aftertouch Posted December 11, 2019 Author Posted December 11, 2019 @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. styleproblem.wmv Quote
Roy_043 Posted December 11, 2019 Posted December 11, 2019 I assume these blocks are generated when required. They do not all exist in the dwg by default. Quote
Aftertouch Posted December 11, 2019 Author Posted December 11, 2019 (edited) I think the same. Anyone knows where there definitions are stored? Even when generated when required.... the source must be somewhere... Edited December 11, 2019 by Aftertouch Quote
Tharwat Posted December 11, 2019 Posted December 11, 2019 Such blocks can be created on the fly in prior of using them by any program. Quote
eldon Posted December 11, 2019 Posted December 11, 2019 Or for leaders, use DIMLDRBLK which uses the same arrowhead entries as DIMBLK Quote
pkenewell Posted December 11, 2019 Posted December 11, 2019 (edited) 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 December 11, 2019 by pkenewell Quote
ronjonp Posted December 11, 2019 Posted December 11, 2019 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") )  2 1 Quote
BIGAL Posted December 12, 2019 Posted December 12, 2019 I could be wrong but I seem to recall using a number to set arrow type will look into VL dump properties. Quote
ronjonp Posted December 12, 2019 Posted December 12, 2019 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. Quote
BIGAL Posted December 12, 2019 Posted December 12, 2019 (edited) 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   Edited December 12, 2019 by BIGAL Quote
pkenewell Posted December 12, 2019 Posted December 12, 2019 (edited) 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 December 12, 2019 by pkenewell Quote
ronjonp Posted December 12, 2019 Posted December 12, 2019 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   There is also this: Quote
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.