Jump to content

Can a lisp be transformed into macro and run on LT?


ROBP

Recommended Posts

  • Replies 28
  • Created
  • Last Reply

Top Posters In This Topic

  • BlackBox

    9

  • BIGAL

    6

  • steven-g

    6

  • Tyke

    5

Top Posters In This Topic

Posted Images

Anxious to get feedback and do some reading

 

I hesitate to disagree with my peers without seeing your LISP, as that in combination with the inherent limitations of LT, will dictate if this can be done.

 

For example, this LISP:

 

(defun c:C () (command "._circle"))

 

... Can be ported to macro:

 

^C^C^P._circle ^P

 

... Whereas any Visual LISP code that utilizes non-LT-exposed APIs will not be able to be ported to macro, unless there is a Command equivalent available.

 

 

 

For this to be properly assessed, more information is needed; please post the LISP code you're wanting to port to macro.

 

Cheers

Link to comment
Share on other sites

It would make answering easier, if you said what the macro needs to do, you certainly cannot just take a lisp routine and swap it over to a macro, but you could probably take the idea and write a macro to suit, providing that LT is capable of what you want to do.

 

EDIT

Having just posted and then seeing Blackbox's reply I would say, please don't post the Lisp, just what it is supposed to do, I have glanced at Lisp code, it may as well be writen in martian :lol:

Link to comment
Share on other sites

Unfortunately the lisp enablers have been taken to task by Autodesk there is a few of them out there, they did not do everything but where pretty good. Best LT enable buy one of the other software options Intellicad Briscad ZWCAD to name a few.

 

Steven-g can you do a script say in notepad and paste to command line ? We have LT at work but its hard for me get on it.

Link to comment
Share on other sites

Unfortunately the lisp enablers have been taken to task by Autodesk there is a few of them out there, they did not do everything but where pretty good. Best LT enable buy one of the other software options Intellicad Briscad ZWCAD to name a few.

 

I do not believe this is what the OP is after.

 

 

 

... can you do a script say in notepad and paste to command line ? We have LT at work but its hard for me get on it.

 

You cannot paste a script's contents to command line, AFAIK.

 

You could however open a given .SCR in the text editor of your choice, and have that file path mapped to a macro, which you would edit the .SCR contents as needed, save, then invoke the macro via menu, toolbar, ribbon, etc.

 

Cheers

Link to comment
Share on other sites

Yes you can paste directly to the command line, I produce scripts in Excel and often just use the copy paste method. You can also do the same from notepad, but one point of note is that using this method you can use command aliases, but if you do use a scr file you have to use the full command.

Link to comment
Share on other sites

 

EDIT

Having just posted and then seeing Blackbox's reply I would say, please don't post the Lisp, just what it is supposed to do, I have glanced at Lisp code, it may as well be writen in martian :lol:

 

Thankfully we're not all so incapable. :thumbsup:

 

While I respect any differing opinion, I do not appreciate you directly asking the OP to not offer what another has requested, particularly when it would help I (and many others) to help the OP... Frankly, I expect better from you, steven-g.

 

 

 

Yes you can paste directly to the command line, I produce scripts in Excel and often just use the copy paste method. You can also do the same from notepad, but one point of note is that using this method you can use command aliases, but if you do use a scr file you have to use the full command.

 

As I have not been relegated to LT for many, many years, thanks for clarifying... I was unaware that one could paste a macro to command line (and it work)... Does this require the macro to be written with ";" as , or does your copy + paste LT functionality accept " " (space) as as well (as an actual macro does in CUI Editor)?

 

Cheers

Link to comment
Share on other sites

Thankfully we're not all so incapable. :thumbsup:

 

While I respect any differing opinion, I do not appreciate you directly asking the OP to not offer what another has requested, particularly when it would help I (and many others) to help the OP... Frankly, I expect better from you, steven-g.

BlackBox sorry if I offended, my comment was 100% tongue in cheek, and in no way was my intention to contradict your good advice, I am fascinated by what can be achieved using LISP and have a great deal of respect for people like yourself who seem to roll out answers quicker than I could even type the offered code, but to people who have not used LISP (me) it is not imediately obvious what the code is supposed to be doing I see things like "VLA" AND "VLAX" and the whole thing filled with brackets, I cannot follow what is happening just by seeing the code, I was only making a plea to the OP to offer a full description of what was expected so that at least in this instance some of us non Lisper's might be able to offer some assistance.

Having reread my previous post it probably would have read better if I had said

please don't post JUST the Lisp, BUT ALSO what it is supposed to do,

Because in a lot of cases it is possible to perform some actions in LT but it needs a bit of persuasion to make it work.

 

 

 

 

 

As I have not been relegated to LT for many, many years, thanks for clarifying... I was unaware that one could paste a macro to command line (and it work)... Does this require the macro to be written with ";" as , or does your copy + paste LT functionality accept " " (space) as as well (as an actual macro does in CUI Editor)?

 

Cheers

Again yes a space is acceptable, one other point to bear in mind is that using diesel there could be a limit to the length of a macro string, although multiple scripts can be called from within a macro itself to cut down on the actual Macro size.

And there are also a few commands that even though they are available in LT canot bypass the dialogue restriction of Macro's

 

PS whilst I maybe a bit slow at seeing the implications and double meaning of some (probably many) of my replies on this Forum I can assure you I am anything but Incapable. :P

Link to comment
Share on other sites

BlackBox sorry if I offended, my comment was 100% tongue in cheek, and in no way was my intention to contradict your good advice, I am fascinated by what can be achieved using LISP and have a great deal of respect for people like yourself who seem to roll out answers quicker than I could even type the offered code, but to people who have not used LISP (me) it is not imediately obvious what the code is supposed to be doing I see things like "VLA" AND "VLAX" and the whole thing filled with brackets, I cannot follow what is happening just by seeing the code, I was only making a plea to the OP to offer a full description of what was expected so that at least in this instance some of us non Lisper's might be able to offer some assistance.

Having reread my previous post it probably would have read better if I had said

Because in a lot of cases it is possible to perform some actions in LT but it needs a bit of persuasion to make it work.

 

Given this response, I must have misunderstood your other comment, in which case please accept my apologies, steven-g. :oops:

 

Your comments here include a great deal of kindness, and respect, that I am humbled to have earned... And for that I thank you.

 

 

 

Again yes a space is acceptable, one other point to bear in mind is that using diesel there could be a limit to the length of a macro string, although multiple scripts can be called from within a macro itself to cut down on the actual Macro size.

And there are also a few commands that even though they are available in LT canot bypass the dialogue restriction of Macro's

 

Again, thanks for clarifying... Admittedly, since I've not used LT in many years I was unaware of this functionality... Further, given the API lock out (as I understand it, I know LISP is no-no, but wonder about .NET now? Hrrrmm), I've not even bothered to download\install ADN copy of LT to test.

 

 

 

PS whilst I maybe a bit slow at seeing the implications and double meaning of some (probably many) of my replies on this Forum I can assure you I am anything but Incapable. :P

 

I was merely responding to your previous word selection, with complete sarcasm - I do not actually believe you to be incapable - Not even of learning martian. :P o:)

 

Cheers

Link to comment
Share on other sites

We're good (and if that doesn't translate it means I'm smiling). As far as I know the only methods of getting LT to do anything other than clicking the mouse, are scripts and macro's, macro's can contain diesel and call scripts (multiple scripts) but they can't negotiate a dialogue box so a command such as quickselect is not available, which I believe is also the case in full Autocad. Quickselect is one of the cases where a bit of persuasion can come in handy.

I have also in the distant past used batch files to process large numbers of autocad drawings, and looked at using the windows scripting command "inkeys", but I don't remember that being very succesful.

Link to comment
Share on other sites

The lisp in question draws pipes elbows an tee's with schedule #

 

According to a small database included in the lisp.

 

Like Steven said i can always use excel and program all the command lines and use lookup to read the data needed along with concatenate it would work but one days work involve maybe more. I did it in excel before but in order to translate the lisp and make it happen one would have to understand all of the commands and what they do, i did some reading on AFRALISP but yet not finished.

 

Of course i can always opt for the solution and run the lisp on a cheaper full cad version (progeCAD) and save them and then output a dynamic block.

 

I will post the lisp sometimes but it needs a little fixing first (osnap and layer make) i am sure it will be useful to somes users.

 

Cheers

R

Link to comment
Share on other sites

Of course i can always opt for the solution and run the lisp on a cheaper full cad version (progeCAD) and save them and then output a dynamic block.

 

Thanks for clarifying your intent... Also, some of those other products support .NET API as well; not sure of your development proficiencies.

 

Cheers

Link to comment
Share on other sites

Thanks Steven-g you have clarified that you can use something like excel as the entry method and either paste to command line or write a script. Being able to just enter values and then have a dwg object appear would be a big time saver for many people just to do simple tasks . In saying that it would be possible to use excell to create a script of field survey codes and produce the linework and symbol plan, yeah no 3d but a plan.

 

The one task asked about here is cabinets and benches this just lends it self to automation using excel's VBA as the programming side. Just cut and paste the lower left corner pt co-ords. Paste the completed panels back in.

 

In finishing it depends on the level of complexity if its interrogating the dwg database then this idea will not work.

Link to comment
Share on other sites

Yeah it gives a real feel of achievement to watch a drawing build up in front of your eyes, at just the click of a button. Another click and the materials cutting list is exported, though in theory that stage is not needed. Plus you can get excel to write out the script file so cutting and pasting is not needed. And if you could do that in 3D :twisted: ;)

Link to comment
Share on other sites

Steven-g Cheats 3d I started doing the bench as a LxWxHt leg size etc it will look 3d when viewed vpoint 1,1,1. A bench top is 1200x600 with thickness 12. If LT supports PFACE draw pline 4 pts then move last 0,0,0 0,0,12 do a hide. Then legs are 50x50 thickness (900-12) I started a excel to have a go at this need a bit of time.

 

bench.jpg

 

Here is lisp version

 

: draw plain bench with legs
; by Alan H Oct 2012
;
;
(setq pi2 (/  pi 2.0)) ; 90 degrees
(setq Pt1 (getpoint "\npick lower left corner point")) 
(setq L (getreal "\nEnter length"))
(setq W (getreal "\nEnter width"))
(setq thick (- 0.0 (getreal "\nEnter bench thickness")))
(setq pt2 (polar pt1 0.0 L))
(setq pt3 (polar pt2 pi2 W))
; do stuff here like layers for now just draw
(command "rectang" pt1 pt3)
(command "extrude" "L" "" thick)
(setq OF1 (getreal "\nEnter Offset from length for legs"))
(setq OF2 (getreal "\nEnter offset from width for legs"))
(setq leg1 (getreal "\nEnter Hor size of leg"))
(setq leg2 (getreal "\nEnter Ver size of leg"))
(setq thick (+ (- 0.0 (getreal "\nEnter height of legs"))thick))
(setq pt4 (polar (polar pt1 0.0 OF1) pi2 OF2)) ;cnr of leg
(setq pt5 (polar (polar pt4 0.0 leg1) pi2 leg2))
(command "rectang" pt4 pt5)
(command "extrude" "L" "" thick)
(setq Cols (- L (+ (* 2.0 OF1) leg1)))
(setq rows (- W (+ (* 2.0 OF2) leg2)))
(command "array" "Last"  "" "R" 2 2 rows cols)

(princ)  ; exit quitely

Link to comment
Share on other sites

Further, given the API lock out (as I understand it, I know LISP is no-no, but wonder about .NET now? Hrrrmm)

 

There is a company in Ohio that markets a product for developers that allows add ons to run in LT. It's called LTX, but it would appear that it is quite legal as it doesn't extend the functionality of LT or unlock any hidden features and is only available to serious developers. Check out the link: http://www.manusoft.com/software/ltx.html

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