Help with flex duct routine

Help with flex duct routine

DC-MWA
Collaborator Collaborator
839 Views
4 Replies
Message 1 of 5

Help with flex duct routine

DC-MWA
Collaborator
Collaborator

Hi all,

I have this little routine I've been using for a long time and I'm trying to modify it a bit.

The original program (written by Charles Alan Butler, 2007) requires a pre-drawn polyline.

I'm trying to add the drawing of the polyline to the routine.

It works but it doesnt like (entlast) for selection of the newly drawn polyine.

Not sure why or how to solve this.

I have attached the lisp.

Any input would be greatly appreciated.

-dc

 

 

 

 

0 Likes
840 Views
4 Replies
Replies (4)
Message 2 of 5

DC-MWA
Collaborator
Collaborator

Ok,

I got the polyline selection figured out. Now I'm trapped in a forever loop??

HHHEEELLLPPP!!!

0 Likes
Message 3 of 5

ВeekeeCZ
Consultant
Consultant

It's a nice routine! Hence that you really should follow his:

 

;;; Author: Copyright© 2010 Charles Alan Butler (CAB)
;;; Contact or Updates @ www.TheSwamp.org

 

...so why you don't try to reach him there? There you might find that a new version is available!

 

 

Following lines I would replace in his latest version 2.0:

 

               FlexLayer ss        FlexCLLayer   lyrent *error* cl-exit
      (initget "Diameter Exit")
      (setq cl-ent
             (entsel (strcat "\nSelect center line of flex duct. "(vl-princ-to-string duct:dia)" [Diameter/Exit] <draw>: "))
      )

      (cond
	((null (setq lyrent (tblobjname "layer" Flexlayer)))
	 (prompt (strcat "\nDuct Layer " Flexlayer " does not exist."))
	)
	((= 4 (logand 4 (cdr (assoc 70 (entget lyrent)))))
	 (prompt (strcat "\nDuct Layer " Flexlayer " is LOCKED."))
        )
	((and FlexCLlayer (/= FlexCLlayer "")
	      (null (setq lyrent (tblobjname "layer" FlexCLlayer)))
	      (princ (strcat "\n*** Center Line Layer " FlexCLlayer " does not exist. ***"))
	      (setq FlexCLlayer nil))
	)
        ((= cl-ent "Exit")  				; new Exit
         nil)
        
        ((and (= (getvar "errno") 52)                   ; picked <draw> pline
              (not (command-s "_.PLINE"))		; drawing
              (setq cl-exit T)                          ; flag for leaving the loop after a duck is drawn
              (setq cl-ent (list (entlast)))
              nil)					; stay within cond
        )
        
        ((= cl-ent "Diameter")
           (princ "\nError - Can not use that object, Try again.")
         )          ; endif
         (not cl-exit) ; exit if pline was drawed
        )
        (t (princ "\nMissed Try again."))

 

0 Likes
Message 4 of 5

DC-MWA
Collaborator
Collaborator

Good point. I was not thinking.

I love the program and mean no disrespect here.

I will reach out to him.

Thank you for bringing me back down to earth.

0 Likes
Message 5 of 5

Moshe-A
Mentor
Mentor

@DC-MWA  hi,

 

what do mean by trapped i the loop? that the program continues until you press escape?

well for that you can do this:

 

add exit to (initget)

(initget "Draw DIameter "eXit")

 

than under the main (cond) add this check:

 

(cond

  ((eq cl-ent "eXit")

   nil ; exit loop

  ); case

  ((= (getvar "errno") 52) ; exit if user pressed ENTER
    nil ; exit loop
  ); case

  (testCase

   .....

  ); case

  (testCase

   .....

  ); case

); cond

 

 

moshe

 

0 Likes