Author Topic: Lisp Alteration  (Read 2886 times)

0 Members and 1 Guest are viewing this topic.

mmccormack

  • Mosquito
  • Posts: 9
Re: Lisp Alteration
« Reply #15 on: April 24, 2023, 05:06:21 AM »
Hi john,

where can I find the 2.3 version and how or where do I learn what's new in the new version... I'm intrigued to know  :-)

Many Thanks.


Matt

JohnK

  • Administrator
  • Seagull
  • Posts: 10669
Re: Lisp Alteration
« Reply #16 on: April 24, 2023, 08:57:23 AM »
Hi john,

where can I find the 2.3 version and how or where do I learn what's new in the new version... I'm intrigued to know  :-)

Many Thanks.


Matt
@mmccormack
I can show you how to comment out a line of code in AutoLisp but I cannot show you how to search the forum.

In AutoLisp you can "comment out" a line by adding a Semicolon in front of it.

Example:
Code - Auto/Visual Lisp: [Select]
  1. (setq Variable1 1)
  2. ; (setq Variable2 2)

"Variable2" is commented out.

To do this, open the lisp file in a "Text Editor" to make the change. I use an editor called "VIM", some use "VS Code", "Notepad+", "UltraEdit", "Crimson", "Atom" (these are all programs you should be googling/trying/etc if you wish to write programs). liuhe gave you one of the lines to comment out, the other is towards the top of the file and is about a "Fill color".


@liuhe
I thought instead changing the color, you could just make the hatch transparent like (and not need those two lines):
Code: [Select]
(vl-cmdf "-hatch" "T" 77 "P" patternName "S" newpline3 "" "")
Again, nice addition to the routine. Thank you.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

mmccormack

  • Mosquito
  • Posts: 9
Re: Lisp Alteration
« Reply #17 on: April 24, 2023, 09:37:17 AM »
Thank you John, I now understand you can "comment out" in a lisp by putting a semicolon in front of it, that bit on information I've taken on board as its new to me and as I'm a complete novice at writing lisp language, I dont know where to  begin.... so that's one bit of information I've learnt today... "commenting out"  Thank you...

Now which line I need to put the semicolon in front of I couldn't tell you... I'm using notepad to view the lisp script, and I can see the bit in regards to the fill color near the top of the file that you referred to, but where does the semicolon go? at the beginning of that line?....


I am planning on looking at a few video tutorials when I get 5mins at work to understand and begin learning on how to write lisp language...
so I do appreciate your assistance and help with this...

Thank you!

JohnK

  • Administrator
  • Seagull
  • Posts: 10669
Re: Lisp Alteration
« Reply #18 on: April 24, 2023, 09:59:14 AM »
Yes, at the beginning of the line.

At one time--when I had more time--I starting writing some tutorials that do address some beginning steps for you to read.

Here are some links to those tutorials (not perfect but I try to teach you how to keep organized when writing code which should be a big help).
https://www.theswamp.org/index.php?topic=55675.msg597934#msg597934
https://www.theswamp.org/index.php?topic=55680.msg597952#msg597952
https://www.theswamp.org/index.php?topic=55692.msg598047#msg598047

When I started I fumbled about for about a year with online tutorials and whatnot until I took a serious course called "Structural and Interpetation of Computer Programs" which really helped. So if you are truly serious and want to play with the big-kids FAST, read the first few chapters of this (you can play around and teach yourself in a few years but if you read a little each day of the following you should be up and runnnig writing serious code in a few weeks).

https://mitp-content-server.mit.edu/books/content/sectbyfn/books_pres_0/6515/sicp.zip/full-text/book/book.html
EDIT
NOTE: The above book teaches the "Scheme" programming language, but the first few chapters are so generic you can "translate" to AutoLisp with a few quick/easy changes.
/EDIT


I wont post the entire file just a few lines from the top and the bottom where I made the changes, you can find the lines in your copy. I commented out the following lines (my quick version looks like this):

I placed a "fancy comment mark ";; ~:" but all you need is a ";".
Code - Auto/Visual Lisp: [Select]
  1.   (setq bulge 1.0)                         ; bulge for rounded duct surface ; CAB 122814
  2.  
  3. ;; ~:    (vla-SetRGB col1 114 116 48 )     ;fill color
  4.   (setq patternName "SOLID")               ;hatch pattern
  5.  

Code - Auto/Visual Lisp: [Select]
  1.  
  2.                 (vl-cmdf "-hatch" "T" 77 "P" patternName "S" newpline3 "" "")
  3.                 (vl-cmdf  "_.DRAWORDER" (entlast) "" "B")
  4.                 (ENTDEL newpline3)
  5. ;; ~:           (vla-put-TrueColor (vlax-ename->vla-object(entlast))col1)
  6.  

After those two changes, you should have a working program. Let us know if you get it working.
« Last Edit: April 24, 2023, 10:05:15 AM by JohnK »
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

mmccormack

  • Mosquito
  • Posts: 9
Re: Lisp Alteration
« Reply #19 on: April 24, 2023, 11:07:18 AM »
Thank you


just working  on it now, altering my lisp file... another question, can i change this to say bylayer? as i would like the solid hatch pattern to be bylayer

orignal
;; ~:    (vla-SetRGB col1 114 116 48 )     ;fill color

it would then read like this instead

;; ~:    (vla-SetRGB col1 "bylayer" )     ;fill color

is this how it works?

JohnK

  • Administrator
  • Seagull
  • Posts: 10669
Re: Lisp Alteration
« Reply #20 on: April 24, 2023, 11:30:53 AM »
You will not need that line (and it is currently commented out because of the ";" at the beginning of the line) but to answer your question, no. That function accepts a RED, GREEN, and BLUE value (it needs four "things") and you would have only provided two 'things' with your change. But if you have it commented out (like it is now), the color will be "by layer".
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

mmccormack

  • Mosquito
  • Posts: 9
Re: Lisp Alteration
« Reply #21 on: April 24, 2023, 11:41:41 AM »
Thank you ever so much John...

I've managed to get the lisp working perfectly... Thanks again for your help and Thanks to everybody else who's responded and helped with the alteration... much appreciated...

and thanks for your links to, will take a look at them when I can....

:-)

JohnK

  • Administrator
  • Seagull
  • Posts: 10669
Re: Lisp Alteration
« Reply #22 on: April 24, 2023, 12:13:19 PM »
No problem but in my opinion, liuhe deserves all the credit.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org