cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Din Rail and Wire Way Length for BOM

Din Rail and Wire Way Length for BOM

Din Rail and Wire Way Lengths from the Din Rail dialog box, are not available in the BOM.

 

Requesting an attribute be added that will populate the "Length" of the Din Rail or Wire Way, from the Din Rail dialog box.

This would make the attribute available for collecting the lengths for the BOM Report.

 

Include the "Length" attribute for the Report, instead of user having to create a WDA file for it.

Provide an option in the BOM Report to collect both individual or total lengths, depending on the Tally and User Post options.

 

Adding this feature will help the User know how much Din Rail or Wire Way is needed for the Project.

4 Comments
testsubject
Advisor

I think this has been asked for before but it still is a good idea. 

 

As a workaround until then, when the Edit Component dialog box opens up, enter the rounded up length in the "Count" field. I then put IN in the Unit Field. (This is in the Catalog Data section)

 

The Count field only accepts integers. (That is why I enter the rounded up value) Now when you do the BOM, you will have a very close estimate of the total length used. This will also appear on reports.

 

This is how I have been doing it for years.

miles.nicholson
Advocate

Create a dynamic block for the trunking and din rail and add your own length, width and depth attributes in the dynamic block. Modify the user attributes file default.wda to read these attributes and then you can have a report that shows height, width and depth where the dimensions are automatically updated based on the dynamic block sizing

chris.downing
Collaborator

this is a very good idea

royperry
Enthusiast

Hi,

Try the LISP below. It adds 3 attributes to the DIN rail or wire conduct as following: "MFG" to keep the MFG data, "CAT" to keep the CAT data, and "CNT" to store the calculated length. This way you can see each DIN in the PANEL BOM.

I hope it helps.

Roy

;; *******************************************************
;; Desigened by Roy Perry 
;; This LISP will do the following:
;; 1. Ask user to select blocks.
;; 2. Add "CNT" attribute to selected block definitions if missing (HDIN... or VDIN...).
;; 3. SYNC the blocks.
;; 4. Measure the length of the selected DIN rails/conducts and store it in "CNT".
;; *******************************************************
;; Type in the command line "DINlength" to use it
;; *******************************************************

(defun c:DINlength ( / ss i ent vlaObj effName doc blocks blkDef 
                            xMFG xCAT len strLen atts tag p1 p2 minPt maxPt)
  (vl-load-com)
  (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
  (setq blocks (vla-get-Blocks doc))

  ;; --- Helper: Extracts the actual string from a specific XDATA App ---
  (defun get-xdata-string (en appName / xd appList val)
    (setq xd (assoc -3 (entget en (list appName))))
    (if (and xd (setq appList (car (cdr xd))))
      ;; Look for the 1000 code which contains the text string
      (setq val (cdr (assoc 1000 (cdr appList))))
      (setq val nil)
    )
    val
  )

  (princ "\nSelect HDIN/VDIN blocks and press Enter: ")
  (if (setq ss (ssget '((0 . "INSERT"))))
    (progn
      (setq i 0)
      (repeat (sslength ss)
        (setq ent (ssname ss i))
        (setq vlaObj (vlax-ename->vla-object ent))
        (setq effName (vlax-get-property vlaObj 'EffectiveName))

        (if (wcmatch (strcase effName) "HDIN*,VDIN*")
          (progn
            ;; 1. EXTRACT CLEAN STRINGS
            (setq xMFG (get-xdata-string ent "VIA_WD_MFG"))
            (setq xCAT (get-xdata-string ent "VIA_WD_CAT"))
            
            ;; 2. CALCULATE LENGTH
            (vla-GetBoundingBox vlaObj 'minPt 'maxPt)
            (setq p1 (vlax-safearray->list minPt)
                  p2 (vlax-safearray->list maxPt))
            (setq len (max (abs (- (car p2) (car p1))) (abs (- (cadr p2) (cadr p1)))))
            (setq strLen (rtos len 2 2))

            (princ (strcat "\nFound -> MFG: " (if xMFG xMFG "Nil") " | CAT: " (if xCAT xCAT "Nil")))

            ;; 3. CHECK/ADD ATTRIBUTES TO DEFINITION
            (setq blkDef (vla-Item blocks effName))
            (setq needsSync nil)
            (foreach tTag '("MFG" "CAT" "CNT")
              (setq found nil)
              (vlax-for obj blkDef
                (if (and (= (vla-get-ObjectName obj) "AcDbAttributeDefinition")
                         (= (strcase (vla-get-TagString obj)) tTag))
                  (setq found T)
                )
              )
              (if (not found)
                (progn 
                  ;; Adding invisible attribute at 0,0 inside the block definition
                  (vla-AddAttribute blkDef 1.0 1 tTag (vlax-3d-point 0 0 0) tTag "")
                  (setq needsSync T)
                )
              )
            )
            
            ;; Synchronize if block definition was changed
            (if needsSync (vl-cmdf "_.ATTSYNC" "_N" effName))

            ;; 4. UPDATE INSTANCE ATTRIBUTES
            (setq atts (vlax-invoke vlaObj 'GetAttributes))
            (foreach att atts
              (setq tag (strcase (vla-get-TagString att)))
              (cond
                ((= tag "MFG") (vla-put-TextString att (if xMFG xMFG "")))
                ((= tag "CAT") (setq res (vla-put-TextString att (if xCAT xCAT ""))))
                ((= tag "CNT") (vla-put-TextString att strLen))
              )
            )
          )
        )
        (setq i (1+ i))
      )
      (princ "\nProcessing complete.")
    )
  )
  (princ)
)
;; *******************************************************

 

Can't find what you're looking for? Ask the community or share your knowledge.

Submit Idea