Discus84 Posted Monday at 12:27 AM Posted Monday at 12:27 AM HI, The yellow line is wall, red is a box. I would like to know if the box fits by turning and sliding into opening. I put it into a circle as a bounding box and manually moved it around to check. There must be a more elegant way of doing this and mabe a way to calculate the max height of such box knowing its width and the wall depth with header height. Thanks! Quote
lrm Posted Monday at 05:08 PM Posted Monday at 05:08 PM (edited) @Discus84 Your question reminded me of the time my son asked me if I could determine if the couch he was planning to buy would fit in the frieght elevator of his aprtment building. There are several way to solove this problem. 1. Make multiple copies of the red box at different angles and then position them with object snap against the walls and floor. 2. Use the paramteric feature of AutoCAD to create and constrain the wall and the box. The following image shows only the angle contraint of the box. Tangency to the wall and floor is made via a dimensional contraint. Here's the result of changing the box angle. The following shows the dimensional and geometric constraints. Note, d3 constrains the box to be flush with the back wall and d9 with the floor. You can edit the dimensions in the attached file to meet yout requirements. box fit.dwg Edited Monday at 06:11 PM by lrm 1 Quote
BIGAL Posted Monday at 11:11 PM Posted Monday at 11:11 PM Did something similar for vehicle driveway checking, just a maybe make the box like 2mm smaller than true size and position and rotate, use intersectwith to see if the box and walls touch you will get nil if they dont.touch. Say stop when get points. 1 Quote
Discus84 Posted Tuesday at 12:58 AM Author Posted Tuesday at 12:58 AM 7 hours ago, lrm said: @Discus84 Your question reminded me of the time my son asked me if I could determine if the couch he was planning to buy would fit in the frieght elevator of his aprtment building. There are several way to solove this problem. 1. Make multiple copies of the red box at different angles and then position them with object snap against the walls and floor. 2. Use the paramteric feature of AutoCAD to create and constrain the wall and the box. The following image shows only the angle contraint of the box. Tangency to the wall and floor is made via a dimensional contraint. Here's the result of changing the box angle. The following shows the dimensional and geometric constraints. Note, d3 constrains the box to be flush with the back wall and d9 with the floor. You can edit the dimensions in the attached file to meet yout requirements. box fit.dwg 72.91 kB · 0 downloads It works as expected...I'm running Autocad clone now and it's hard to get the constraint definitions but this certainly works ! Thanks Quote
lrm Posted Tuesday at 01:37 AM Posted Tuesday at 01:37 AM @Discus84 I have found that when creating geometry to be used with the parametric feature it is best not to create any lines or polylines orthogonal to the world. E.g., Create you box somewhat rotated and then it's clearer what constraints you need, both dimensional and geometric constraints. Quote
indiancad Posted Tuesday at 05:16 AM Posted Tuesday at 05:16 AM Try using `REGION` and `INTERSECT` to check for collisions as you rotate and slide the box through the opening. This method is more accurate than using a circle. The `REGION` command helps define the shape of the box and `INTERSECT` checks if it overlaps with the opening. It gives results because it follows the exact shape of box instead of relying on a circle that might be too big or too small. You can test this by moving the box and checking for collisions at each step. It works well when the box is, at odd angles. Just make sure the box and the opening are properly defined as regions. Quote
lrm Posted 1 hour ago Posted 1 hour ago (edited) box_animation.mp4 box_animation.mp4 I thought I would have some more fun with this problem. As I posted earlier, I think AutoCAD's parametric features offer a good solution. Here's an easier construct. Open the attached file and go to the Parametric tab and click Show All or enter the command DCDISPLAY and select the box to see the dimensional constraints. Change the value of dimension d3 to see the box in a different position agaist the wall. The following VLISP program creates a box of user specified dimensions and animates it position and orientation as it slides along the floow and wall. 0,0 is assumed to be the lower corner of the wall. box_animation.mp4 ;Creates an animation of a rectangle slding along a floor ; as it rotates leaning agains a wall. ; 11/13/2026 (defun c:boxanimate (/ ang boxL boxW dAngle dAngleR p i d vlaObj nSteps dx) (vl-load-com) (setq boxL (getreal "\nEnter box length (9): ")) (if (not boxL) (setq boxL 9) ) (setq boxw (getreal "\nEnter box width (2) ")) (if (not boxW) (setq boxW 2) ) (setq dAngle 1 ; rotation angle increment ang dAngle ; total rotation dAngleR (/ (* pi dAngle) 180.) p (list (- boxL) 0) ; poit of rotation i 0 d 100 ; delay value ) (command "_rectangle" "_non" p "_non" (list 0 boxW)) (setq vlaObj (vlax-ename->vla-object (entlast))) (setq nSteps (/ 90 dAngle)) (setvar "CMDECHO" 0) (while (< i nsteps) (setq angR (/ (* pi ang) 180.)) (setq dx (abs (+ (car p) (* boxL (cos angR))))) (vla-Rotate vlaObj (vlax-3d-point p) dAngleR) (vla-Move vlaObj (vlax-3d-point '(0.0 0.0 0.0)) (vlax-3d-point (list dx 0.0 0.0)) ) (setq ang (+ ang dAngle) p (mapcar '+ p (list dx 0)) ) (vla-update (vlax-get-acad-object)) (command-s "_.REGEN") (command "_.DELAY" 100) (setq i (1+ i)) ) (setvar "CMDECHO" 1) (princ) ) ; end defun box fit.02.dwg Edited 1 hour ago by lrm Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.