Results 1 to 6 of 6

Thread: AMEP 09 Duct Size Help

  1. #1
    I could stop if I wanted to
    Join Date
    2015-12
    Posts
    385
    Login to Give a bone
    0

    Default AMEP 09 Duct Size Help

    Hello all,

    I am trying to use a block with attributes to size dyuct work in AMEP 09.
    I would like to use the autosizing feature but this is not (yet) company standard.

    I would like to know how to select a duct and obtain its width and height so that I may use it in a routine.

    If anyone could help fill in my holes or have better suggestions, I certainly would appreciate it.

    Thanks in advance,
    Andre

    Code:
    defun c:test (/ bname selduct ductw ducth sp1 attval) 
    (setq bname "XXX")
    
    (setq selduct (select duct))
    (setq ductw  (get selduct's width))
    (setq ducth  (get selduct's height))
    
    (setq attval1 (strcat (rtos ductw 2 0) "x"(rtos ducth 2 0)))
    
    (command "insert" "bname" "s" 1 "r" 0 pause)
    (command attval1)
    (setq sp1 (getvar "lastpoint"))
    (command "rotate" (entlast) "" sp1 pause)
    (princ))

  2. #2
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: AMEP 09 Duct Size Help

    I do not have MEP, but if ActiveX is a supported API, this should help you track down what you are looking for:

    Code:
    (defun c:DUMP  ()
      (vl-load-com)
      (terpri)
      (vlax-dump-object
        (vlax-ename->vla-object
          (car (entsel "\n  >>  Select Object to Dump Contents: ")))
        T)
      (textpage)
      (terpri)
      (princ)) ;_end defun
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  3. #3
    I could stop if I wanted to
    Join Date
    2015-12
    Posts
    385
    Login to Give a bone
    0

    Default Re: AMEP 09 Duct Size Help

    Quote Originally Posted by RenderMan;1092967[code
    (defun cUMP ()
    (vl-load-com)
    (terpri)...
    [/code]
    This showed me the CrossSectionSize (RO) =

    which is what I would want but how can I use that information?

  4. #4
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: AMEP 09 Duct Size Help

    Give this a try:

    Code:
    (defun c:TEST  (/ ss attval1 ductw)
      (vl-load-com)
      (cond
        (*activeDoc*)
        ((setq *activeDoc* (vla-get-activedocument (vlax-get-acad-object)))))
      (if (setq ss (ssget ":S:E" '((0 . "INSERT") (2 . "XXX"))))
        (progn
          (vlax-for x  (vla-get-activeselectionset *activeDoc*)
            (setq attval1
                   (strcat
                     (rtos (setq ductw (vla-get-crosssectionsize x))
                           2
                           0)
                     "x"
                     (rtos ductw 2 0))))
          (vla-delete ss)
          (command "._-insert" "XXX" pause 1 1 pause attval1)))
      (princ))
     
    ;; Note - Error checking not provided.
    This should be a good start.

    I'd really like to replace all of the command functions with ActiveX functions, but I'm going to need more information for that. The block, and perhaps a sample drawing with the items you're working with, etc... but not having MEP, I'm not sure I can help entirely.

    Hope this helps!
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  5. #5
    I could stop if I wanted to
    Join Date
    2015-12
    Posts
    385
    Login to Give a bone
    0

    Smile Re: AMEP 09 Duct Size Help

    well thanks to your help, I have a working lisp.
    Here is how I am pulling the information, but the full lisp I am not yet allowed to post.

    If you see any major errors or improvements, always aprpeciated.
    Thanks for your help.

    Code:
    (defun c:CrossSec (/ obj attsuf sz att1)
      (vl-load-com)
    
      (setq obj (vlax-ename->vla-object
    	      (car(entsel "\nSelect duct to size: \n"))))
    
      
      (if (/= obj nil)
        (progn
          (if (vlax-property-available-p obj 'ShapeName)
    	(progn
    	  (if (= (vlax-get obj 'ShapeName) "Rectangular")
    	    (progn
    	      (setq attsuf "")
    	      )
    	    )
    	  (if (= (vlax-get obj 'ShapeName) "Round")
    	    (progn
    	      (setq attsuf " Diameter\n")
    	      )
    	    )
    	  )
    	)            
          (if (vlax-property-available-p obj 'CrossSectionSize)
    	(progn
    	  (setq sz (vlax-get obj 'CrossSectionSize))
    	  (setq att1 (strcat sz attsuf))
    	  (princ (strcat "\nDuct size = " att1))
    	  )
    	)
          )
        )
      (princ))
    Thank you very much for your help, you just saved me about 2 hours a day (possibly more).

    Andre

  6. #6
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: AMEP 09 Duct Size Help

    You can combine steps, and simultaniously avoid errors:

    Code:
    (defun c:CrossSec  (/ obj attsuf)
      (vl-load-com)
      (terpri)
      (if (and (setq obj (vlax-ename->vla-object
                           (car (entsel "\nSelect duct to size: \n"))))
               (vlax-property-available-p obj 'ShapeName)
               (vlax-property-available-p obj 'CrossSectionSize))
        (princ
          (strcat
            "\nDuct size = "
            (vlax-get-CrossSectionSize obj)
            (cond
              ((= "RECTANGULAR" (strcase (vlax-get-ShapeName obj)))
               (setq attsuf ""))
              ((= "ROUND" (strcase (vlax-get-ShapeName obj)))
               (setq attsuf " Diameter ")))))
        (prompt "\n  <!>  Selected Duct Does Not Meet Criteria  <!> "))
      (terpri)
      (princ))
    Let me know if you'd like me to provide a more detailed explanation of what I mean by combining, or avoiding errors.

    Happy coding!
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

Similar Threads

  1. 2014: Duct size inch marks remove from duct size tag
    By rbelfiore337841 in forum Revit MEP - General
    Replies: 3
    Last Post: 2014-10-24, 02:28 PM
  2. AMEP Duct connections
    By joseph_turc in forum AMEP General
    Replies: 3
    Last Post: 2011-07-12, 02:22 PM
  3. Moving attributed block over duct crashes AMEP
    By jab.196272 in forum AMEP General
    Replies: 7
    Last Post: 2009-03-11, 07:52 PM
  4. AMEP Duct not showing up in ACAD
    By Beancud in forum AMEP General
    Replies: 4
    Last Post: 2009-01-30, 02:04 PM
  5. AMEP 2009: duct size wrong !
    By btankut in forum AMEP General
    Replies: 2
    Last Post: 2009-01-09, 03:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •