Jump to content

From autolisp to icon


rengised

Recommended Posts

Hi eveybody i need help about the autolisp, how to add autolisp to an icon? i have downloaded some autolisp from this site, by the way thanks a lot for those share their knowledge and autlisp. Could please share to me what are the steps to create an icon from autlisp, instead of typing the command i just want to click it.:)

Link to comment
Share on other sites

  • Replies 29
  • Created
  • Last Reply

Top Posters In This Topic

  • rengised

    11

  • Lee Mac

    11

  • alanjt

    6

  • lpseifert

    2

Top Posters In This Topic

Posted Images

if you're asking how to make a toolbar command button...

In CUI create a new Command using something similar as this for the macro

^c^c(if (not c:[i][color=Red]lispcommand[/color][/i])(load "[i][color=Red]lispfile[/color][/i]" nil));[i][color=Red]lispcommand[/color][/i];

then drag the command up to a toolbar

 

a search probably would have led you to this

http://www.cadtutor.net/forum/showthread.php?t=48387

j1.jpg

Link to comment
Share on other sites

Hi lpseifert thanks for the help.

I have already the toolbar button, but the proble is i dont know what would be tha macro for the lisp. i will attached the sample lisp and please teach the technique and what should put on the macro. Thanks:):)

getareas.lsp

boxed.lsp

Link to comment
Share on other sites

Hi Rengised,

 

I feel honoured that you are using my programs :D

 

As for the macro, as lpseifert has posted above or,

 

^C^Cgetareas;

 

if you know that the lisp files are already loaded.

Link to comment
Share on other sites

Hi LeeMac, thanks fro the quick reply.

Its my hounored that you replied on my question.

Yes, i have downloaded and used your programs and those are very useful, i am very thank to you and to the others here always sharing their knowledge.

I know that my qustion is very simple for you, coz i dont have any background on creating programs or lisp.

Tomorrow i will try the code, and i am sure it will works.

Thanks all to you guys..

and thanks to this site

:):):):):)

Link to comment
Share on other sites

Hi LeeMac its me again, i need a favor again if you dont mind.

I attached the sample drawing for trimming the intersection.:)

Thanks.

Sample.jpg

Link to comment
Share on other sites

The way I approached the problem is to:

  • Prompt user for a selection of Lines (assuming all are lines at the moment - simplifies things a little).

  • Convert the SelectionSet into a list of VLA-objects (easier to work with).

  • For each object in turn, find the intersections between that object and every other object in the SelectionSet.

  • For each set of intersections, break the object at the first two intersections in the list (reasonable assumption using the diagrams of usage and the fact we are only dealing with lines.)

Library functions I used:

 

Convert a SelectionSet into a list of VLA-Objects:

;; ss  ~  SelectionSet
(defun LM:ss->vla ( ss )
 ;; © Lee Mac  ~  15.06.10
 (if ss
   (
     (lambda ( i / e l )
       (while (setq e (ssname ss (setq i (1+ i))))
         (setq l (cons (vlax-ename->vla-object e) l))
       )
       l
     )
     -1
   )
 )
)

 

Return a list of intersections between an object and a list of objects:

 

;; Obj ~  VLA-Object for use in all intersection tests
;; ObjLst ~  List of VLA-Objects to be tested against Obj
(defun LM:IntersectWith ( obj ObjLst )
 ;; © Lee Mac  ~  15.06.10
 (apply 'append
   (mapcar
    '(lambda ( o )
       (LM:GroupByNum
         (vlax-invoke obj 'IntersectWith o acExtendNone) 3
       )
     )
    ObjLst
   )
 )
)

;; Group List by Number
;; l ~  list to be grouped
;; n ~  number of elements to group by
(defun LM:GroupByNum ( l n / a b )
 ;; © Lee Mac  ~  15.06.10
 (while l
   (
     (lambda ( i )
       (while (< 0 i)
         (setq a (cons (car l) a) l (cdr l) i (1- i))
       )
       (setq b (cons (reverse a) b) a nil)
     )
     n
   )
 )
 (reverse b)
)

 

Good luck!

Link to comment
Share on other sites

  • 2 weeks later...

Hi LeeMac, thanks for your patience and help, but i dont get it and i dont know what is vla... Anyway Thanks very much......

Link to comment
Share on other sites

Hi LeeMac, i dont know if what i have done is correct.. What i did is i copy and paste the code and save it as .lsp (example LM.lsp) in the note pad... Thanks again LeeMac i really appreciate your help and patience..

Link to comment
Share on other sites

Those are only Library functions to be used to perhaps create a program, they aren't programs in themselves.

 

Have you written LISP before?

Link to comment
Share on other sites

Thanks LeeMac again, unfortunately I havent write an LISP before. That is my big problem and want to learn as well.

Link to comment
Share on other sites

Thanks LeeMac again, unfortunately I havent write an LISP before. That is my big problem and want to learn as well.

 

Have you check these out?

http://www.afralisp.net/

http://www.jefferypsanders.com/autolisptut.html

http://ronleigh.info/autolisp/index.htm

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