Jump to content

LISP to create custom wire labels


jjben

Recommended Posts


I could use some help with creating a LISP file to generate wire labels. Here is how I would like the program to work (see screenshot and dwg).
 

User loads and runs routine

1. User is prompted to SELECT 1ST blocktxt. Program extracts the first 8 characters from the model tag, it skips counting spaces. Or extract all characters up to the left bracket, which ever comes first. Then append a colon and space
2) Next the user is prompted to SELECT 1st text, which extracts the last digit or last two digits.  If there are no digits at the end of the string then extract the last word (eg OUT). Then append a line break
3) Then the user is prompted to SELECT 2nd blocktxt, program extracts the first 8 characters from the model tag, skip counting spaces. Or extract all characters up to the left bracket, which ever comes first. Then append a colon and space
4) Next the user is prompted to SELECT 2nd text, which extracts the last digit or last two digits.  If there are no digits at the end of the string then extract the last word (eg OUT).  
5) Allow user to place resulting mtext in the drawing on the Label layer

 

Here is the desired results on the Label layer from the drawing and pic below

 

DP DA 2: 1
TH-55CQE: 1

 

 

I found this LISP that extracts all text from multiple blocks and converts it to mtext.

https://autocadtips1.com/2011/04/26/autolisp-attribute-to-text-mtext/

 

And this LISP combines multiple selected text in to one mtext

 

http://www.lee-mac.com/text2mtext.html

 

I thought these  two LISPs might be helpful as a starting place.

 

 

 

cablelabelpic.JPG

cadsample (1).dwg

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