Dynamic Block for a control cabinet

KGD
KGD
edited March 2023 in 2D Drafting
Hello! I would like to create a control cabinet as dynamic block. I will use this in 2D floor plans. It basically is a rectangle with doors. The length and width of the rectangle should be resizable. My issue is that I need to divide the control cabinet into fields. Sometimes I need a control cabinet that is comprised of 2 fields or more. This means the width of the control cabinet will be divided by the number of fields which at the same time is the length of the door. You can see in the picture a 3.2m wide control cabinet with 4 fields, where one door is 3.2/4 = 0.8m.




Can you help me create this block, where I can choose parameters like length, width and number of doors? The scaling and stretching of these door swings is pretty hard.

Comments

  • ALANH
    edited March 2023
    Must it be a dyn block ? Can make it in lisp drawing objects to suit.

    Why not block, door1, door2, door4, etc just scale to suit draw 1 unit long. Scale=3.2

    Should it have rules can be inbuilt like, max door width / 0.8 so auto block.
  • ALANH said:

    Must it be a dyn block ? Can make it in lisp drawing objects to suit.

    You are right. I didn't think about LISP. It does not have to be a dynamic block.
    I should learn LISP...

    If it doesn't take too much time for you, could you make a start in LISP for me, so I can work from there, please?

  • There is plenty of people who can help, to do the task properly need you to provide a few rules.
    max & min door size,
    Outside edge gap
    Internal gap between doors
    Can do left or right or ask for each door ?

    Provide a proper sample dwg including frame etc.

    Like this can be done

  • The 2D control cabinet for floor plans is attached to my post. This is what I used until now.
    The min door width is 600mm
    The max door width is 800mm
    No gaps needed, not applicable
    Left or right door choice would be a great addition
    I will try to develop it a bit further
  • ALANH
    edited March 2023
    Try this version 1 just to show maybe how it can be done, will add left or right plus front end for sizes next. Please test and let me know if OK.

    ; https://forum.bricsys.com/discussion/38121/dynamic-block-for-a-control-cabinet#latest

    (defun c:wow ( / pt pt1 len pt2 pt3 pt4 num frac)
    (setq oldsnap (getvar 'osmode))
    (setvar 'attreq 1)
    (setvar 'osmode 0)
    (setq TIEFE 0.4)
    (setq HÖHE 1.2)
    (setq BESCHREIBUNG "X")
    (setq pt (getpoint "\nPick left hand point "))
    (setq pt1 pt)
    (setq len (getdist "\nEnter length of cabinet "))
    (If (< len 0.6)
    (alert "Length entered is to small less than 0.6m")
    (progn
    (setq pt2 (mapcar '+ pt1 (list len TIEFE 0.0)))
    (command "rectang" pt1 pt2)
    (setq pt3 (mapcar '* (mapcar '+ pt1 pt2) '(0.5 0.5)))
    (setvar 'clayer "GA_Schaltschränke")
    (command "-hatch" "P" "Solid" pt3 "")
    (command "chprop" (entlast) "" "C" "RGB:0,119,200" "")
    (setq num (/ len 0.8))
    (setq frac (- num (fix num)))
    (if (> frac 0.0)
    (setq num (+ 1 (fix num)))
    )
    (setq dwid (/ len num))
    (setq x 1)
    (repeat num
    (setq pt3 (mapcar '+ pt (list (* x dwid) 0.0 0.0)))
    (setq pt4 (mapcar '+ pt1 (list 0.0 (- dwid) 0.0)))
    (command "arc" "c" pt1 pt4 pt3)
    (command "line" pt1 pt4 "")
    (setq x (1+ x))
    (setq pt1 pt3)
    )
    (command "-insert" "cabinet" "s" 1 (mapcar '+ pt (list 0.05 -0.185 0.0)) 0.0 BESCHREIBUNG (rtos len 2 2) (rtos TIEFE 2 2) (rtos HÖHE 2 2))
    )
    )
    (setvar 'osmode oldsnap)
    (princ)
    )
    (c:wow)

    I have made a block for you its Cabinet in the dwg attached. You can rename it.
  • NTCL
    edited March 2023


    @KGD
    My two cents:
    A multi visibility state dynamic block (AutoCAD) or Parametric block (BricsCAD) may solve your problems. For example: Built a 4-state block, with the number of doors change from 1 to 4.
    A dynamic multi visibility state block from AutoCAD can be used in BricsCAD, but cannot be edited
    BricsCAD V23 has a "Parametric Block Assist" to convert AutoCAD dynamic block => BricsCAD parametric block.
    *
    I spend an hour this morning with BricsCAD parametric block definition. The procedures of show/ hide entities in each state by selected on screen was very confused. Finally, I found that "Parametric Block Assist".

  • The better answer is just enter the length and the visibilty state is set correctly see code above to work out how many.

    I use Lee-mac dynamic block properties.lsp to set block properties.

    The dynamic block needs more rules around the arc size so any cabinet length can be entered, Don't forget also width.