• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

controllo input

  • Thread starter Thread starter Angelo2449
  • Start date Start date

Angelo2449

Guest
Hello everyone,
in this code :
Code:
 (repeat 10)

(setq cont (1+ cont))

(setq title1 (strcat "select the point name " (itoa cont))))
(setq ed1 (entsel (strcat "\n" title1))

(setq list (entget (car ed1) '("group")))
(setq xlist (assoc -3 list)
(setq txtdata (car))

(if (= xlist nil)
(alert "the selected string is not suitable, no extended data is associated!")
)

(setq string)
(setq nomex (cdr)
(setq type of point (nth 2 txtdata)))
(setq share (cdr (nth 3 txtdata))))
(setq ecef (nth 4 txtdata)))
(setq gaussboaga (cdr 5 txtdata)))
(setq controllerstz (nth 6 txtdata)))
(setq controllerpt (nth 7 txtdata)))
);
I would like the string suit check message not to interrupt the loop (repeat) and allow me to continue by selecting a suitable point.
Thank you very much.
 
you could in the choice "else" instead of interrupting copying the code used in the "if" with a different message.
It's practically the same code within itself, you'll change a message with "you don't have a proper point, try again."
 
With the lisp I haven't had to deal with for a long time... .
you have a "repee" cycle that is repeated so that the condition is true, while if it is false, here comes the message and stops.
If you don't want to block it, it changes the end of the cycle.
 
Hello everyone,
in this code :
Code:
 (repeat 10)

(setq cont (1+ cont))

(setq title1 (strcat "select the point name " (itoa cont))))
(setq ed1 (entsel (strcat "\n" title1))

(setq list (entget (car ed1) '("group")))
(setq xlist (assoc -3 list)
(setq txtdata (car))

(if (= xlist nil)
(alert "the selected string is not suitable, no extended data is associated!")
(progn)
(setq string)
(setq nomex (cdr)
(setq type of point (nth 2 txtdata)))
(setq share (cdr (nth 3 txtdata))))
(setq ecef (nth 4 txtdata)))
(setq gaussboaga (cdr 5 txtdata)))
(setq controllerstz (nth 6 txtdata)))
(setq controllerpt (nth 7 txtdata)))
); else
);
);
ok?
 
I think he wants this.
- in the choice of the point repeats the previous number if the same result is inidoneo
- increase the cycle meter (step) only if the point is suitable
Code:
 (setq step 10) ; set the number of cycles here

(sing)
(progn)
(setq cont (1+ cont))
(setq title1 (strcat "select the point name " (itoa cont))))
(setq ed1 (entsel (strcat "\n" title1))
(setq list (entget (car ed1) '("group")))
(setq xlist (assoc -3 list)
(setq txtdata (car))
(if (= xlist nil)
(progn)
(alert "the selected string is not suitable, no extended data is associated!")
(setq cont (1- cont))
)
(progn)
(setq string)
(setq nomex (cdr)
(setq type of point (nth 2 txtdata)))
(setq share (cdr (nth 3 txtdata))))
(setq ecef (nth 4 txtdata)))
(setq gaussboaga (cdr 5 txtdata)))
(setq controllerstz (nth 6 txtdata)))
(setq controllerpt (nth 7 txtdata)))
(setq step (1- step))
)
)
(zerop step)
)
)
 
thanks rpor66,
I rewrote the code:
Code:
 (setq xlist nil)

(repeat 1000)

(and (= ed3 nil) (= edx 0)
(setq cont (1+ cont))
(setq contuno (1+ contuno)
(setq title1 (strcat "select the point name " (itoa cont))))
(setq ed3 (entsel (strcat "\n" title1))
(Sectq and 1 ed)

(if (= ed3 nil); ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
(progn)
(setq boundarystr (vl-string-trim " contourstr))
(setq fp1 (open "c:\\\autocadsupport\\\\\\\\\stringa.dat" "a"))
(write-line contourstr fp1)
(close fp)

(setq fp2 (open "c:\\\\autocadsupport\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
(write-line sumpoints fp2)
(close fp)

(startapp "c:\autocadsupporto\\\liberty\\\sino7.exe "c:\\autocadsupport\\\\liberty\\\\sino7.tkn")

(seq control1 nil)
(while (= control1 nil)
(setq control1 (findfile "c:\\\autocadsupporto\\dati\\\ replies.dat"))
);

(Sectq answer nil)
(while)
(setq fp1 (open "c:\\\autocadsupporto\\dati\\risposta.dat" "r"))
(setq codcolor (read-line fp1))
(setq codlinea (read-line fp1))
(setq answer (read-line fp1))
(close fp)
);

(princ "\n")
(princ)
(princ reply)
(princ "\n")

(if)
(progn)
(seq saved (strcat "contorno saved (" (itoa (- contuno 1)) ") points"))
(alert saved)
(exit)
);
);

(if)
(setq cont (1- cont))
(setq contuno (1- contuno)
);
);

);;if --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

);

(princ "\n")
(princ "ed1 > > > > > > > > > > > > > > > > )
(princ ed1)
(princ "\n")

(setq list (entget (car ed1) '("group")))
(setq xlist (assoc -3 list)

(if (= xlist nil)
(progn)
(alert "the selected item is not suitable, no extensive data is associated!")
(setq cont (1- cont))
);

(progn)
(setq txtdata (car))
(setq string)
(setq nomex (cdr)
(setq type of point (nth 2 txtdata)))
(setq share (cdr (nth 3 txtdata))))
(setq ecef (nth 4 txtdata)))
(setq gaussboaga (cdr 5 txtdata)))
(setq controllerstz (nth 6 txtdata)))
(setq controllerpt (nth 7 txtdata)))

(setq pos1 (vl-string-search "("namex 1))
(setq point name (substr nomex 1 (- pos1 1)))

(if (> (rem cont 2) 0);
(progn)
(See case 1)
(princ case)
(if (= cont 1);
(progn)
(setq gb1 gaussboaga)
(setq boundarystr point name)
);
(progn; selections beyond the first
(setq gb3 gb2); copy gb2 in gb3
(setq gb4 gaussboaga)
(command "_line" gb3 gb4 ")
(command "_change" "_last" "_p" "_layer" "red"")
(setq gb3 gb4)
(setq boundarystr (strcat boundarystr "|" name))
(setq sumpoints (strcat sumpoints "-" gaussboaga))
);
);
);
);

(if (= (rem cont 2) 0);
(progn)
(Section 2)
(princ case)
(if (= cont 2);
(progn)
(setq gb2 gaussboaga)
(command "_line" gb1 gb2")
(command "_change" "_last" "_p" "_layer" "red"")
(setq boundarystr (strcat boundarystr "|" name))
(setq sumpoints (strcat sumpoints "-" gaussboaga))
);
(progn)
(setq gb2 gaussboaga)
(command "_line" gb2 gb3 ")
(command "_change" "_last" "_p" "_layer" "red"")
(setq boundarystr (strcat boundarystr "|" name))
(setq sumpoints (strcat sumpoints "-" gaussboaga))
);
);
);
);

(princ "\n")
(princ contornostr >>>> > > > > > > > )
(princ contourstr)
(princ "\n")

(if (= cont 10)
(progn)
(setq fp1 (open "c:\\\autocadsupport\\\\\\\\\stringa.dat" "a"))
(write-line contourstr fp1)
(close fp)
(setq cont 0)
(setq boundarystr ")
);
);

(Sectq and 1 nil)
(Sectq ed3 nil)

(setq intlibretto 1); syno7.exe writes in book price
(intestinal setq (- contune 1) 2))
(Sections 0)

(princ "\n")
(princ "intgraphic > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > )
(princ intgraphic)
(princ "\n")
);
);
);
now the input is controlled by : (if (= xlist nil)
but the case of xlist = nil , starts a loop that I can't finish if not acting through the operation of Windows 10.
is always exposed: "the selected element is not suitable, no extensive data is associated!" and there is no
to continue.
I do not think that the solution is valid because this control is exercised in case you select a graphic element like a line but not if the selection concerns any text.
summarizing:
- the selection must cover a text element that has extended data.
- all sorts of selection must be rejected.
- in case of wrong selection, the chosen loop, after the error message, must continue.
- in case of selection nothing, the loop stops and the question is asked.
I think the control should be exercised immediately on the selected item (ed3).
How?
Thank you.
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top