Jump to content

Create MLeader Using Visual LISP


ksperopoulos

Recommended Posts

Thank you Lee , I am aware of that emulation of Vanilla in VLisp though I still prefer using dictsearch function than Vlisp in this regard.

 

Tharwat was warning me about based on examples you have given me before.

 

Where did I warned you about that?

Link to comment
Share on other sites

  • Replies 27
  • Created
  • Last Reply

Top Posters In This Topic

  • ksperopoulos

    15

  • Tharwat

    10

  • Lee Mac

    3

Top Posters In This Topic

Ok. So in this case, would the vl-catch-all-apply function be applied like this?

(vl-catch-all-apply 'vla-item (vla-item (vla-get-dictionaries doc) "ACAD_MLEADERSTYLE") ([i]mleader style name[/i]))

 

Not quite - as noted above, vl-catch-all-apply requires a list of arguments.

 

It would also be prudent to test for the existence of the acad_mleaderstyle dictionary to account for versions in which MLeaders are not available, i.e.:

(if
   (not
       (or
           (vl-catch-all-error-p
               (setq dic
                   (vl-catch-all-apply 'vla-item
                       (list
                           (vla-get-dictionaries
                               (vla-get-activedocument
                                   (vlax-get-acad-object)
                               )
                           )
                           "acad_mleaderstyle"
                       )
                   )
               )
           )
           (vl-catch-all-error-p
               (setq sty
                   (vl-catch-all-apply 'vla-item
                       (list dic "yourmleaderstylehere")
                   )
               )
           )
       )
   )
   sty
)

Alternatively, using my LM:getitem function linked above:

(if (setq dic (LM:getitem (vla-get-dictionaries (vla-get-activedocument (vlax-get-acad-object))) "acad_mleaderstyle"))
   (LM:getitem dic "yourmleaderstylehere")
)

Link to comment
Share on other sites

But did you try to search for your MLStyle name while it is not existed into your drawing your codes as follows?

 

 

 

...just that I should have something in my code to protect me from unwanted results due to a mleader style that does not exist in my drawing file.

Link to comment
Share on other sites

...just that I should have something in my code to protect me from unwanted results due to a mleader style that does not exist in my drawing file.

 

I did not post any complete codes as long as you have mentioned in your first post that you need a direction and don't want anyone to write it for you also as long as you'd like to investigate it by yourself that would be encouraging thing.

 

is there any logic reason which made you to go with VLisp versus DXF ?

Link to comment
Share on other sites

I did not post any complete codes as long as you have mentioned in your first post that you need a direction and don't want anyone to write it for you also as long as you'd like to investigate it by yourself that would be encouraging thing.

 

I know you didn't post code. I wasn't expecting you to. I do want to learn. I was merely stating you were helping me and that I could run into errors if I didn't check for the mleader style first.

 

is there any logic reason which made you to go with Vlisp and with DXF ?

 

There was no logical reason. I was just curious about another method to see which one I would like better.

Link to comment
Share on other sites

There was no logical reason. I was just curious about another method to see which one I would like better.

 

If you'd like to know my opinion about the which way to go with coding with which codes Lisp or Vlisp , I would go first with DXF codes unless it needs too much line of codes otherwise I would jump to Vlisp.

 

DXF or Vanilla AutoLISP is faster, easier than Vlisp, covers almost all you to do with daily works in general and what's more it's cute. :)

Link to comment
Share on other sites

It would also be prudent to test for the existence of the acad_mleaderstyle dictionary to account for versions in which MLeaders are not available

 

Thank you for the suggestion. I don't know if I would necessarily need the first vl-catch-all-apply due to our offices operating on release 2014 and later, but it might be worth incorporating it just in case.

 

In regards to your code, do I understand it correctly?

It seems you are passing arguments to your subfunction?

Also, can you make anything into a list by using the list function?

 

 

(Sorry for my ignorance. I still have a little trouble figuring out if a function returns/uses arguments, elements, objects, lists, etc.)

Link to comment
Share on other sites

If you'd like to know my opinion about the which way to go with coding with which codes Lisp or Vlisp , I would go first with DXF codes unless it needs too much line of codes otherwise I would jump to Vlisp.

 

DXF or Vanilla AutoLISP is faster, easier than Vlisp, covers almost all you to do with daily works in general and what's more it's cute. :)

 

I would tend to agree. But recently, I have been looking at a lot of coding from others that use VL. The terminology seems easier to understand and refer back to without using a help file (especially for a novice like me). Right now trying to figure it out is difficult because the only thing I have experience with is vanilla LISP. I'm sure that won't always be the case though once I get used to it.

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