Author Topic: Help with Lisp program to assign text to an attribute  (Read 1118 times)

0 Members and 1 Guest are viewing this topic.

abayterg

  • Mosquito
  • Posts: 6
Help with Lisp program to assign text to an attribute
« on: August 29, 2022, 01:21:31 PM »
I don't know how to write lisp scripts so I need help to write  a lisp code to do the following:

i need to number pedestals that are often in the rear of the houses but they can be on the front too, then assign the house number and then take the street name and extract the first letter of each word.

 

so first i would need to ask the user if it is Front or Rear and write F or R depending the input.

 

Then ask the user to select the text that contain the number of the house

 

Then ask the user to select the street name and extract the first letter of each word.

 

For example:

Front or rear? (Rear)

click address number (4504)

click street name (West Spruce Street)

 

Result should be sent to an specific attribute and should be: R 4504 WSS

 

 

Thanks in advance ! hope to hear from you soon

« Last Edit: August 30, 2022, 08:56:19 AM by abayterg »

Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: Help with Lisp program to assign text to an attribute
« Reply #1 on: August 29, 2022, 02:42:27 PM »
Result should be sent to an specific attribute and should be: R 4504 WSS

Are you going to select the attributed block to set the value in a certain attribute tag string ? 

abayterg

  • Mosquito
  • Posts: 6
Re: Help with Lisp program to assign text to an attribute
« Reply #2 on: August 29, 2022, 02:50:00 PM »
I am going to select a mleader which contains the attribute or attributes if needed, where i need the information

JohnK

  • Administrator
  • Seagull
  • Posts: 10659
Re: Help with Lisp program to assign text to an attribute
« Reply #3 on: August 29, 2022, 03:02:37 PM »
You said attributeS. Does that mean that there can be multiple blocks with the same attributes?

You could make the "reporting block" (the one with the final string: "R 4504 WSS") store the handles of the "address", and "street" text. That way, in the future you can just run an "update" procedure to update the `reporting block'.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

abayterg

  • Mosquito
  • Posts: 6
Re: Help with Lisp program to assign text to an attribute
« Reply #4 on: August 29, 2022, 03:12:28 PM »
Anything that works, i can make a block with 3 attributes, the position, address and street and then update the values after the parse.
The thing is that i dont know to write lisp code, usually i take the codes that people post on forums like this one.

could you help me to write it please.

JohnK

  • Administrator
  • Seagull
  • Posts: 10659
Re: Help with Lisp program to assign text to an attribute
« Reply #5 on: August 29, 2022, 03:16:19 PM »
Oh we can certainly start you down the right path at least!

Have you read any introductions to lisp? Do you program in any languages? Do you have a favorite text editor? Are you an organized person (do you have your own directory structure)?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

abayterg

  • Mosquito
  • Posts: 6
Re: Help with Lisp program to assign text to an attribute
« Reply #6 on: August 29, 2022, 03:22:51 PM »
Long time ago i used to write html-css-javascript on atom program. but i need this ASAP if you can help me  :laugh:

BIGAL

  • Swamp Rat
  • Posts: 1430
  • 40 + years of using Autocad
Re: Help with Lisp program to assign text to an attribute
« Reply #7 on: August 29, 2022, 09:04:29 PM »
Post a sample dwg that has text and block to use.
A man who never made a mistake never made anything

abayterg

  • Mosquito
  • Posts: 6
Re: Help with Lisp program to assign text to an attribute
« Reply #8 on: August 30, 2022, 07:48:23 AM »

Hello here an example , thank you