Is it possible =)
I would like to know if it is possible to have a lisp routine or a vba expression to click on the object and then have the block fill that opening & extract information from it.I work for a cabinet shop and would like to click on an opening .. IE a rectangle showing the door opening and have a door block be inserted and then be able to extract that information from it so that door can be produced.Let me know if something like this can be done .. I have a dynamic block that will do it but i have to stretch it each time and every time there is a revision its a possibility to be missed so I'm looking for something that is a little more full proof.Thanks for the help
Joey G Anything is possible
Are you
[*] Working from a 2D elevation ?
[*] Is the rectangle a 2D LWPOLYLINE ?
[*] Do you have door standards to meet ?
[*] Does the block need to be a 3D model for a CNC conversion ?
To name a few
-David its all 2D and it would be a polyline ... We have a standard but we are fully custom so it could change job to job & no these are all hand machined and built. I picture it and can probably use it too for a different purpose but the automatic block inserting part to the exact dimensions i need to see that put to work.
The return data and self correcting block thing and then reinsertion it.
Let see what the experts will be able to cook up on this challenge. Yes ... lets see what these amazing Cad wizards can do !! This could be used to the rectangle size ( and location when needed ).
(defun c:test (/ ss pl i en ed e1 e2) (and (setq ss (ssget (list (cons 0 "LWPOLYLINE") (cons 70 1); (cons 90 4) ))) (setq pl nil i 0) (while (setq en (ssname ss i)) (setq ed (entget en)) (foreach g ed (if (= 10 (car g)) (setq pl (cons (cdr g) pl)))) (setq i (1+ i)))) (cond ((/= 4 (length pl)) (alert "Only 4 Point Rectangles Allowed")) ((not (equal (mapcar '(lambda (a b) (* (+ a b) 0.5)) (nth 0 pl) (nth 2 pl)) (mapcar '(lambda (a b) (* (+ a b) 0.5)) (nth 1 pl) (nth 3 pl)) 1e-8)) (alert "Not A True Rectangle")) (T (setq e1 (distance (nth 0 pl) (nth 1 pl)) e2 (distance (nth 1 pl) (nth 2 pl))) (alert (strcat "Rectangle Size \n" "Edge 1 = " (rtos e1 2 2) "\n" "Edge 2 = " (rtos e2 2 2)))))(prin1))
We'll need a bit more info or a sample would be helpful
-David
PSI do wish AutoDesk never used the term rectangle.There is no RECTANGLE entity type and there are several ways to produce the same geometry. This is great David ... I need that information to be pushed into a block w/ dynamic function when I click on the "rectangle" that it fills that opening to that size. Here is a test file ... Door.dwg Here could be a base engine :
(defun c:test (/ ss pl i en ed z e1 e2 ll lr ur ul) (and (setq ss (ssget (list (cons 0 "LWPOLYLINE") (cons 70 1) (cons 90 4)))) (setq i 0) (while (setq en (ssname ss i)) (setq ed (entget en) z (cdr (assoc 38 ed)) pl nil) (foreach g ed (if (= 10 (car g)) (setq pl (cons (cdr g) pl)))) (cond ((/= 4 (length pl)) (alert "Only 4 Point Rectangles Allowed")) ((not (equal (mapcar '(lambda (a b) (* (+ a b) 0.5)) (nth 0 pl) (nth 2 pl)) (mapcar '(lambda (a b) (* (+ a b) 0.5)) (nth 1 pl) (nth 3 pl)) 1e-8)) (alert "Not A True Rectangle")) ((not (or (equal 0 (angle (nth 0 pl) (nth 1 pl)) 1e-4) (equal 0 (angle (nth 1 pl) (nth 2 pl)) 1e-4))) (alert "Not An Orthographic Rectangle")) (T (setq e1 (distance (nth 0 pl) (nth 1 pl)) e2 (distance (nth 1 pl) (nth 2 pl))); (alert (strcat "Rectangle Size \n"; "Edge 1 = " (rtos e1 2 2) "\n"; "Edge 2 = " (rtos e2 2 2))) (setq ll (list (apply 'min (mapcar 'car pl)) (apply 'min (mapcar 'cadr pl)) z) ur (list (apply 'max (mapcar 'car pl)) (apply 'max (mapcar 'cadr pl)) z) lr (list (car ur) (cadr ll) z) ul (list (car ll) (cadr ur) z)) (nw_mdoor ll lr ur ul))) (setq i (1+ i))))(prin1))(defun nw_mdoor (ll lr ur ul / c bn) (setq c 0) (entmake (list (cons 0 "BLOCK")(cons 2 "*U")(cons 70 1)(cons 10 ll))) (foreach d '(0.125 2.125 2.75) (entmake (list (cons 0 "3DFACE")(cons 62 (setq c (1+ c))) (cons 10 (polar ll (* pi 0.25) (* d (sqrt 2)))) (cons 11 (polar lr (* pi 0.75) (* d (sqrt 2)))) (cons 12 (polar ur (* pi 1.25) (* d (sqrt 2)))) (cons 13 (polar ul (* pi 1.75) (* d (sqrt 2))))))) (setq bn (entmake (list (cons 0 "ENDBLK")(cons 8 "0")))) (entmake (list (cons 0 "INSERT")(cons 2 bn)(cons 10 ll)))(prin1))
If you want a true dynamic block, it would take a lot of work.I don't use them because these type of routines are dynamic in and of themselves.
The options and inputs are almost unlimited. ie door hinging, door pull style.
You could make the borders and stiles variable just as easily
Anyway, it is a starting point for you to develop further.
-David. Maybe another idea use dims on a layer (turn off) then make the attribute values read the dim field nice thing strech the door the block updates.
页:
[1]
2