CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.
(setq FlexLayer "0") ; put your Duct layer here (setq FlexColor acred) ; put your color over ride here or Bylayer (setq InsulThick 0) ; to be added to duct diameter, use 2 for 1" insulation (setq collar 4.0) ; collar length at each end (setq DelCL nil) ; delete the centerline t=Yes nil=No (setq GroupFlex t) ; make flex duct a Group t=Yes nil=No
;; Expects pts to be a list of 2D or 3D points (defun makePline (spc pts) (if (= (length (car pts)) 2) ; 2d point list (setq pts (apply 'append pts)) (setq pts (apply 'append (mapcar '(lambda (x) (list (car x) (cadr x))) pts)) ) ) (setq pts (vlax-make-variant (vlax-safearray-fill (vlax-make-safearray vlax-vbdouble (cons 0 (1- (length pts)))) pts ) ) ) (vla-addlightweightpolyline spc pts) ) ;; -------------------------------------
(defun _CreateAnonymousGroup ( ) ; courtesy of Michael Puckett (vla-add (vla-get-groups (vla-get-activedocument (vlax-get-acad-object))) "*") )
;; Get the Duct Diameter, global variable (or duct:dia (setq duct:dia 16.0)) ; default value
;; =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ;; S T A R T H E R E ;; =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= (while ; Main Loop (progn (prompt (strcat "\nDuct diameter is set to " (vl-princ-to-string duct:dia) ) ) (setvar "errno" 0) ; must pre set the errno to 0 (initget "Diameter") (setq cl-ent (entsel (strcat "\nSelect center line of flex duct.[Diameter]<" (vl-princ-to-string duct:dia) "> Enter to quit.")) )
(cond ((= (getvar "errno") 52) ; exit if user pressed ENTER nil ; exit loop ) ((= cl-ent "Diameter") (initget (+ 2 4)) (setq tmp (getdist (strcat "\nSpecify duct diameter <" (rtos duct:dia) ">: ") ) ) (and tmp (setq duct:dia tmp)) t ; stay in loop )
((not (null cl-ent)) ;; check entity before making the duct (if (not (vl-catch-all-error-p (setq tmp (vl-catch-all-apply 'vlax-curve-getpointatparam (list (car cl-ent) 0.0) ) ) ) ) (progn ; OK to make duct (setq cl-ent (car cl-ent) ; Center Line ribWidth (* duct:dia 0.167) RibShort (+ duct:dia InsulThick) ; add insulation RibLong (+ RibShort (* ribWidth 2)) )
) ) ; cond ) ; progn (princ "\nError - Can not use that object, Try again.") ) ; endif t ) (t (princ "\nMissed Try again.")) ) ; cond stmt ) ; progn ) ; while (vla-endundomark doc) (vlax-release-object space) (vlax-release-object doc) ;;----------- E N D O F L I S P ---------------------------- (princ) ) (prompt "\nFlex Duct loaded, Enter FLEX to run.") (princ)
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum