Author Topic: (Challenge) BCC-9000  (Read 2304 times)

0 Members and 1 Guest are viewing this topic.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
(Challenge) BCC-9000
« on: March 16, 2010, 12:20:23 PM »
A crystal maker has just purchased one the new box machines, the BCC-9000, to help with packaging their expensive vases, bowls, etc. for storage and shipping.

The BCC-9000 is a wonderful machine and technological masterpiece but it needs input, much like a CNC machine does. It can take a sheet of cardboard, cut it, fold it and make a lid to match but it needs dimensions to do so. The BCC-9000 gets its dimensions by scanning a sheet of paper and reading the line work, solid line indicates sheet size, dashed lines represent the fold lines.

Each piece of crystal has a item number and dimensions (Length, Width and Depth) associated with it. Your job, as the programmer, is to create the line work based on these dimensions. The dimensions and item number will be entered by the CAD Tech and then printed.

The line work will consist of an outline(rectangle) which indicates the total size of the sheet. It will also have fold lines(dashed) which represents the bottom and sides of the box. And it will have the item number in the center of the sheet.

You can write the whole program or a sub-routine for it.

Have fun!
TheSwamp.org  (serving the CAD community since 2003)

Lee Mac

  • Seagull
  • Posts: 12923
  • London, England
Re: (Challenge) BCC-9000
« Reply #1 on: March 16, 2010, 12:52:49 PM »
Maybe I have misunderstood the challenge, but from a first glance...

Code: [Select]
(defun c:fold (/ Line CP D DELTAX DELTAY GR L P1 P11 P12 P13 P14 P2 P3 P4 P7 P8 PT W XPART YPART)

  (defun Line (p1 p2 lt)
    (entmakex (list (cons 0 "LINE") (cons 6  lt)
                    (cons 10 p1)    (cons 11 p2))))

  (setq l 1. w 1. d 1.)

  (if (setq pt (getpoint "\nPick Corner for Outline: "))
    (progn

      (while (and (= 5 (car (setq gr (grread 't 13 0))))
                  (listp (setq cP (cadr gr))))
        (redraw)

        (setq DeltaX (- (car  cP) (car pt))
              DeltaY (- (cadr cP) (cadr pt)))

        (setq xPart  (/ DeltaX (+ (* 2. d) l))
              yPart  (/ DeltaY (+ (* 2. d) w)))

        (setq p1  (list (+ (car pt) (* d xPart)) (cadr pt))
              p2  (list (+ (car p1) (* l xPart)) (cadr pt))
              p3  (list    (car cP)              (cadr pt)))

        (setq p4  (list    (car pt)           (+ (cadr pt) (* d yPart)))
              p7  (list    (car cP)              (cadr p4)))

        (setq p8  (list    (car pt)           (+ (cadr pt) (* (+ d w) yPart)))
              p11 (list    (car cP)              (cadr p8)))

        (setq p12 (list    (car pt)              (cadr cP))
              p13 (list    (car p1)              (cadr cP))
              p14 (list    (car p2)              (cadr cP)))

        (grvecs (cons 1  (setq l1 (list pt p3 pt p12 p12 cP cP p3))))

        (grvecs (cons -3 (setq l2 (list p1 p13 p2 p14 p4 p7 p8 p11)))))

      (while (cadr l1)
        (Line (car l1) (cadr l1) "CONTINUOUS")
        (Line (car l2) (cadr l2) "HIDDEN")
        (setq l1 (cddr l1) l2 (cddr l2)))))

  (redraw)
  (princ))

Assumes HIDDEN linetype loaded.  :-)
« Last Edit: March 18, 2010, 10:14:41 AM by Lee Mac »

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: (Challenge) BCC-9000
« Reply #2 on: March 16, 2010, 01:12:34 PM »
Hey, wait just a second here: you trying to get us to do your work for free?  I don't think so.

 :-D
James Buzbee
Windows 8

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: (Challenge) BCC-9000
« Reply #3 on: March 16, 2010, 01:16:58 PM »
That is pretty darn close! :)

Guess I'll have to try harder next time.
TheSwamp.org  (serving the CAD community since 2003)

Lee Mac

  • Seagull
  • Posts: 12923
  • London, England
Re: (Challenge) BCC-9000
« Reply #4 on: March 16, 2010, 04:39:56 PM »
That is pretty darn close! :)

Guess I'll have to try harder next time.

Thanks Mark 8-)

Shame the grread doesn't permit Osnap etc... I suppose a prompt could be added for the LxWxD ratios  :-)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: (Challenge) BCC-9000
« Reply #5 on: March 17, 2010, 06:48:27 PM »
Have you tried to fold that figure into a box? :?

The corner must be a square and have a diagonal fold.
At least one other dimension must be >= the height of the box or the fold will not work.
« Last Edit: March 17, 2010, 06:56:26 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.