Jump to content

Recommended Posts

Posted (edited)

hello everyone

 

i got a routine which enables me to enter a prefix for sequentially numbered text which uses the Dtext routine to place text on the current layer in the current text style.

 

generally i use it to TO MARK S A SINGLE WIRE ... for exemple: 04.1,04.2,04.3.... where "04." is the perfix, the starting number is 1, the incremental number is also 1

 

it's work perfectly!!

 

now i need to upgrade it a little to mark some 2/3/4 WIRES:

i mean somthing like that:

 

-2 wires: 04.1/04.2,04.3/04.4,...

 

-3 wires:04.1/04.2/04.3,04.4/04.5/04.6,...

 

-4 wires: 04.1/04.2/04.3/04.4,04.5/04.6/04.7/04.8,...

 

unfortinaley i 'am not that good in lisp, so i say you probably can help me out.

 

here is the code:

 

 
;;;This WSNUM.LSP routine enables you to enter a prefix for sequentially
;;;numbered text which uses the Dtext routine to place text on the current
;;;layer in the current text style.
;;;
;;;This file has been edited from the 'cabnum.lsp' routine
;;;originally created by Elise Moss of Moss Designs.
;;;[url]www.mossdesigns.com[/url], August 2001
;;;
;;;
;;;Michael E. Beall
;;;michael.beall@autocadtrainerguy.com
;;;[url]www.autocadtrainerguy.com[/url], January 2002
;;;502.633.3994 (voice + FAX)
;;;Modified 4 August 2o11 - accepts decimal numbers for text height input
;;;                       - accepts only whole numbers for all other input
;;;                       - error in incrementation corrected
;;;                       - general tidying up and reorganisation of code

(defun c:wsnum	()

 ; get prefix 
 (setq prefix (getstring "\nPrefix <04.>? "))
 (if (= prefix "")
   (setq prefix "04.")
 )

 ; get starting number
 (setq stnum (getint "\nStarting number <1>? "))
 (if (= stnum nil)
   (setq stnum 1)
 )

 ; get increment
 (setq incrnum (getint "\nIncrement numbers by <1>? "))
 (if (= incrnum nil)
   (setq incrnum 1)
 )

 ; get text height
 (setq txtht (getreal "\nSet text height to <1.4>: "))
 (if (= txtht nil)
   (setq txtht 1.0)
 )

 ; get insertion point
 (setq placepoint (getpoint "\nSelect text location: "))

 ; set placement string
 (setq label (strcat prefix "" (itoa stnum)))
 
 ; loop for all subsequent insertions, ESC or right click ends loop
[color="red"] (while (/= placepoint nil)
   (setq label (strcat prefix " " (itoa stnum)))		; set placement string
   (command "text" placepoint txtht "0" label)			; place text
   (setq stnum (+ stnum incrnum))				; increment number
   (setq placepoint (getpoint "\nSelect text location: "))	; get next insertion point[/color]
 )					;end while
 (princ)
)					; end defun
(prompt "\nType WSNUM to run. ")

 

i got lost there guys, any help is welcome

 

thanks in advance

Edited by BIIST
Posted

I would suggest my numbering program found here, but this will only allow one section of the text to be incremented.

Posted

hey lee

i used fews of your scripts ...very usefull and it saved a lot of my time ...thank you

 

your script seems good...mores options :yes: , wil try it later...but i need to know if there is any possibilities to allow 2-3-4 section of a text to be incremented

 

thanks in advance

Posted

A little closer, this will increment multiple sections of a string, but currently only by an increment of 1.

 

This has given me a new idea for an application for my site... how about a program that prompts for a selection of text/mtext and asks which sections to increment (with the option to select multiple sections), then asks for the increment. The user could then continously place copies of the selected object, incrementing the selected sections.

Posted

 

This has given me a new idea for an application for my site... how about a program that prompts for a selection of text/mtext and asks which sections to increment (with the option to select multiple sections), then asks for the increment. The user could then continously place copies of the selected object, incrementing the selected sections.

 

Nice idea...this excatly what i am looking for

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