Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

New to lisp

22 REPLIES 22
SOLVED
Reply
Message 1 of 23
rfigueroa24PK4
1021 Views, 22 Replies

New to lisp

Hello all

 

As the title says I'm new to lisp and I am trying to create and see how these things work. I am currently in need of a lisp routine that will do wire labels for me.

 

I have 8 different label types based on signal type. V, A, S, P, C, N, NA, NV, RF

All labels would have a Prefix and 3 digits such as "A001"

The attributes are in blocks

There are 3 different blocks "WIRE-IN",  "WIRE-OUT" and "POWER-IN"

BOTH the wire-in and wire-out have a "WIRE" Tag attribute. The power-in has a "WIRE 1" and "WIRE 2" Tag attribute.

I would like to click once on each type of block and it automatically label it the next number in sequence

example: click on one wire-in block and it label A001 and click on one wire-out block and it label A001, then move on to the next set of blocks for A002 and so on. 

I obviously would need to select the Prefix first and have the option to type the number sequence to begin with.

 

Hopefully I made sense explaining this. I was never good at programming, code, C+ and all that stuff barely passed the class with a D+ and shook the teachers hand said thank you and left quickly. So looking at this is truly like speaking Klingon for me lolol. 

22 REPLIES 22
Message 21 of 23
Moshe-A
in reply to: rfigueroa24PK4

@rfigueroa24PK4 ,

 

OOPS, Sorry

 

Find this line code and replace it with bellow (actually the function 'vl-every' should be replaced with 'mapcar')

now it will work 😀

 

(setq _setAttribValue  (lambda (ents tags vals) (mapcar (function (lambda (ent tag val) (setpropertyvalue ent tag val))) ents tags vals)))

 

 

 

Message 22 of 23
rfigueroa24PK4
in reply to: Moshe-A

Moshe_a 

 

Thank you very much, that seems to have fixed it and everything is working as intended. You sir are a genius in this and I would've never been able to figure this out on my own lol.

Message 23 of 23
rfigueroa24PK4
in reply to: Moshe-A

So go figure I've been using this lisp for the last week wonderfully since you made it and finally found a flaw in my request. The entire time I've been thinking of just labeling pairs like wire-in with wire-out and completely forgot there are times where we actually do pairs like wire-in with wire-in and wire-out with wire-out. Which means in these scenarios the lisp will not work because its only looking for a wire-in and wire out pair. lolol.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta