CAD Forum - Database of tips, tricks and utilities for AutoCAD, Inventor and other Autodesk products [www.cadforum.cz]
CZ | EN | DE
Login or
registration
  Visitors: 3939
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

 

HelpCAD discussion

 
CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.

How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

The information that you provide in this form will make up your forum profile which can be viewed by other forum members. Your email address will only be visible by forum admin and moderators and will be used to send you Forum Notifications. To cancel your account, use the page Opt-out or contact webmaster@cadforum.cz.

LISP to generate wire labels

 Post Reply Post Reply
Author
joeljbennett View Drop Down
Newbie
Newbie


Joined: 28.May.2022
Location: United States
Using: Autocad 2022
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote joeljbennett Quote  Post ReplyReply Direct Link To This Post Topic: LISP to generate wire labels
    Posted: 28.May.2022 at 06:23
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).

 

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.





Back to Top

Related CAD tips:


 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,078 seconds.