Jump to content

Add suffix


hidxb123

Recommended Posts

Friends :D

 

Please help to add suffix in the following lisp , i need suffix increment along with no's increment

Example 1A,2A

The starting no i want to type on the screen unless it will be '1'

 

 

(DEFUN C:WS()
 (setvar "insunits" 4)
 (setvar "dimasz" 3.0)
 (command "snap" "off")
 (SETQ NUM (getint "\nEnter Weld No. [1]: "))
 (if (= NUM nil) (SETQ NUM (fix 1)))
 (while (setq P1 (getpoint "\nSelect First Point: "))
   (setq P2 (getpoint "\nSelect Second Point: "))
   (command "donut" 0 3.2 P1 "" ".dim" "lea" P1 P2 ^C "exit" "circle" P2 "6.40")
   (setq Las1 (entlast))
   (command "TRIM" Las1 "" P2 "" "erase" Las1 ""  
            "-insert" "C:\\hpc\\SYM_S0.dwg" "S" "14" p2 "" NUM
   )
   (setq NUM (1+ NUM))    
 );while
);defun

Edited by hidxb123
Link to comment
Share on other sites

Dear Girr

 

Can you please edit on my lisp ,:)

 

Try it, I can't test it:

(defun C:WS ( / *error* Svars num suff P1 P2 )
(defun *error* (m) 
	(and Svars (mapcar 'setvar (mapcar 'car Svars) (mapcar 'cdr Svars)))
	(print m) (princ)
)
(setq Svars (mapcar '(lambda (x) (cons x (getvar x))) '("INSUNITS" "DIMASZ" "CMDECHO")))
(and Svars (mapcar 'setvar (mapcar 'car Svars) '(4 3.0 0)))
(command "_.SNAP" "OFF")
(or (setq num (getint "\nEnter Weld No. < 1 >:")) (setq num 1))
(setq suff (getstring "\nSpecify Suffix: "))
(while (and (setq P1 (getpoint "\nSelect First Point: ")) (setq P2 (getpoint "\nSelect Second Point: ")))
	(if (not (command "_.DONUT" 0 3.2 P1 "" ".dim" "lea" P1 P2 ^C "exit" "CIRCLE" P2 "6.40"))
		(command "_.TRIM" (entlast) "" P2 "" "erase" (entlast) ""  
			"-INSERT" "C:\\hpc\\SYM_S0.dwg" "S" "14" P2 "" (strcat (rtos num 2 0) suff)
		)
	)
	(setq num (1+ num))    
);while
(and Svars (mapcar 'setvar (mapcar 'car Svars) (mapcar 'cdr Svars)))
(princ)
)

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