Display only the result

Display only the result

saitoib
Advocate Advocate
1,298 Views
17 Replies
Message 1 of 18

Display only the result

saitoib
Advocate
Advocate
Hi all.

AutoLisp can suppress the display of the command line with "cmdecho", but it is not possible to display only the result without displaying the change in the middle of processing the figure.

Thank you.
Saitoib
0 Likes
Accepted solutions (1)
1,299 Views
17 Replies
Replies (17)
Message 2 of 18

ВeekeeCZ
Consultant
Consultant

It depends... which command, in particular, do you have in mind?

0 Likes
Message 3 of 18

saitoib
Advocate
Advocate
(defun set_bound (ss / xy pt1 pt2 outl ptin )
  (setq xy (_getdiagonal ss))     ;min and max of select sets
  (setq pt1 (list (car (car xy)) (cadr (car xy))))
  (setq pt2 (list (car (cadr xy)) (cadr (cadr xy))))
  (setq pt1 (mapcar '(lambda (x) (- x 10)) pt1))
  (setq pt2 (mapcar '(lambda (x) (+ x 10)) pt2))
  (setq ptin (mapcar '(lambda (x) (+ x 5)) pt1))
  ;------ invisible
  (command "_isolateobjects" ss "")
  (command "_rectang" pt1 pt2)
  (setq outl (entlast))
  (command "_boundary" ptin "")
  (command "_erase" (entlast) "")
  (setq bound (entlast))
  (command "_erase" outl "")
  (command "_unisolateobjects")
  ;----- visible
  bound
)
Saitoib
0 Likes
Message 4 of 18

ВeekeeCZ
Consultant
Consultant

How would I know what result you have interested in?? Or if expect me to simply answer Yes/No, then Yes. 

0 Likes
Message 5 of 18

komondormrex
Mentor
Mentor

try NOMUTT variable

0 Likes
Message 6 of 18

saitoib
Advocate
Advocate

@komondormrex 

I tried (setvar "nomutt" 1).
I think the effect is the same as (setvar "cmdecho" 0), but what do you think?


I need to run the above routine about 10 times.
As it is now, the screen seems to blink because I repeat writing and erasing frames.

Is there any way to avoid this?

 

Thank you.

 

Saitoib
0 Likes
Message 7 of 18

komondormrex
Mentor
Mentor

you may try to reprogram your function using activex, except for boundary command.

0 Likes
Message 8 of 18

saitoib
Advocate
Advocate

@komondormrex 

Do you mean ActiveX is a vla related command?
I don't know much about vla.
Can I make my wish come true if I use the vla command?

Saitoib
0 Likes
Message 9 of 18

komondormrex
Mentor
Mentor

yes, that is exactly what i mean

0 Likes
Message 10 of 18

saitoib
Advocate
Advocate

@komondormrex 

All right.
I'll try to study.

Saitoib
0 Likes
Message 11 of 18

ВeekeeCZ
Consultant
Consultant

You don't really need to move to activex to get some prompt visible.

I don't know what "result" you're expecting to see.

You can either turn the cmdecho on for some particular command... as

 (command "_isolateobjects" ss "")
  (command "_rectang" pt1 pt2)
  (setq outl (entlast))
  (command "_boundary" ptin "")
(setvar 'cmdecho 1)
  (command "_erase" (entlast) "") ; now this command's echo would be printed...
(setvar 'cmdecho 0)
  (setq bound (entlast))
  (command "_erase" outl "")
  (command "_unisolateobjects")
 
Or just make some your own counter...
(setq ctr 0) ; before the loop...
 
(princ (strcat "\nRun " (itoa (setq ctr (1+ ctr))))) ; place this into the loop.
0 Likes
Message 12 of 18

komondormrex
Mentor
Mentor

and what is exactly the purpose of set_bound function?

0 Likes
Message 13 of 18

Kent1Cooper
Consultant
Consultant

@komondormrex wrote:

and what is exactly the purpose of set_bound function?


It appears to be a "shrinkwrap" routine, making an outline around the entirety of a selection set.  But if I understand what it's doing, it may require that the selection set are all connected, like the left side of this image from simulating what it does [not from the routine directly, since I don't have the sub-routines]:

Kent1Cooper_0-1675862536996.png

The red objects are the selection set.  It draws the temporary box outboard of everything [dashed grey], uses BOUNDARY to wrap everything, Erases the outer-perimeter result as the Last object, saves what then remains as the last object [blue] to the 'bound' variable, and Erases the temporary outboard rectangle.

 

But if the selected objects don't all touch, the outer-perimeter result from BOUNDARY can't be relied on to be the last object and be Erased!  In the right half, BOUNDARY resulted in four objects, and the last one, to be Erased, was not the outer-perimeter one, but the one over the quadrilateral.  The one that was then Last, and would be saved to 'bound,' was the blue one over the Circle.  The two yellow ones, over the Ellipse and the outer perimeter, remain!

 

In this case it may be a result of the fact that one of the selected objects is an Ellipse, so it had to make Regions instead of Polylines.  Apparently that messes with the drawn order of the result -- with one that can make Polylines, in very limited trial it seems the outer-perimeter one is always the Last object.  So it seems if the selected objects will only and always be Polyline-able things [never an Ellipse or Spline or Region derived from either of those], then the outer-perimeter Polyline will successfully be Erased.  But what then goes into the 'bound' variable will still be what wraps only part of the original selection.

Kent Cooper, AIA
0 Likes
Message 14 of 18

komondormrex
Mentor
Mentor
Accepted solution

@Kent1Cooper wrote:

@komondormrex wrote:

and what is exactly the purpose of set_bound function?


It appears to be a "shrinkwrap" routine


 

you seem to be correct.

 

@saitoib well then for the start. wcs.

 

 

 

(defun set_bound (ss / llc ruc llc_list ruc_list min_x min_y max_x max_y 10+_offset_rectangle)
	(foreach ename (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
		(vla-getboundingbox (vlax-ename->vla-object ename) 'llc 'ruc)
		(setq llc_list (append llc_list (list (vlax-safearray->list llc)))
			  ruc_list (append ruc_list (list (vlax-safearray->list ruc)))
		)
	)
	(setq min_x (apply 'min (mapcar 'car llc_list))
		  min_y (apply 'min (mapcar 'cadr llc_list))
		  max_x (apply 'max (mapcar 'car ruc_list))
		  max_y (apply 'max (mapcar 'cadr ruc_list))
	)
	(setq 10+_offset_rectangle (vlax-invoke (vla-get-block
												(vla-get-activelayout
													(vla-get-activedocument
														(vlax-get-acad-object)
													)
												)
											)
										  	'addlightweightpolyline
										  	(list (- min_x 10) (- min_y 10)
												  (- min_x 10) (+ max_y 10)
										  		  (+ max_x 10) (+ max_y 10)
												  (+ max_x 10) (- min_y 10)
												  (- min_x 10) (- min_y 10)
										  	)
							  	)
	)
	(setvar 'cmdecho 0)
	(command-s "_-boundary" "_a" "_o" "_p" "_b" "_n"
			  ss (vlax-vla-object->ename 10+_offset_rectangle) "" ""
			  (list (- min_x 5) (- min_y 5)) ""
	)
	(setvar 'cmdecho 1)
	(mapcar 'vla-erase (list 10+_offset_rectangle (vlax-ename->vla-object (entlast))))
	(setq boundary (entlast))
	(sssetfirst nil (ssadd boundary))
	boundary
)

 

 

 

0 Likes
Message 15 of 18

saitoib
Advocate
Advocate

@komondormrex 

Thank you for posting the valuable code.
I still haven't studied enough, so it will take a little time to fully understand the contents.
However, I have a basic question.
I think the code you posted has almost the same operation procedure.
Even so, I can't see the rectangle creation and deletion operations in your code. Is it because ActivX is moving fast?

 

@Kent1Cooper 
Thank you for your detailed explanation.
I'm not good at explaining, so it was helpful.

 

Saitoib
0 Likes
Message 16 of 18

komondormrex
Mentor
Mentor


@saitoib wrote:
I think the code you posted has almost the same operation procedure.
Even so, I can't see the rectangle creation and deletion operations in your code. Is it because ActivX is moving fast?

yes, activex does it on the background and fairly quickly. and one more thing - (un)isolate commands wеnt into  boundary command. 

0 Likes
Message 17 of 18

saitoib
Advocate
Advocate

@komondormrex 

Thank you very much.
I will study hard.

Saitoib
0 Likes
Message 18 of 18

wa7154733
Community Visitor
Community Visitor

Thank you for sharing this information about AutoLisp and the limitations in displaying only the result without showing the changes during processing. It's good to know that "cmdecho" can suppress the command line display. Although displaying only the swertres result today  during processing may not be possible, understanding this limitation can help in working with AutoLisp effectively.

0 Likes