Cadmando- Posted March 20 Posted March 20 (edited) I used Divide command but its slow. So I tried to create a Divide command, pause for selecting arc, Line exc. Insert c-chair4 block and pause for how many blocks inserted. my lisp command not working. I what Dialog box to open ups and insert number of blocks. would be niece is PREVIEW along with Dialog box can anyone help, or dose anyone know a good AI to help create lisp and dcl routings. here my code:DIB.LSP (defun c:DIB (/ ent num-divisions i pt segment-length) ;; Prompt user to select a line or polyline (setq ent (car (entsel "\nSelect a line or polyline to divide: "))) ;; Ensure that the entity is valid (line or polyline) (if (or (= (vla-get-objectname (vlax-ename->vla-object ent)) "AcDbLine") (= (vla-get-objectname (vlax-ename->vla-object ent)) "AcDbPolyline")) (progn ;; Ask user for the number of divisions (setq num-divisions (getint "\nEnter the number of divisions: ")) ;; Calculate the segment length for each division (setq segment-length (/ (vlax-curve-getLength ent) num-divisions)) ;; Insert the block at each division point (setq i 0) ;; Start the division count (repeat num-divisions ;; Calculate the point at the current division (setq pt (vlax-curve-getPointAtDist ent (* i segment-length))) ;; Insert the block at the division point (command "INSERT" "C-CHAIR4" pt "1" "1" "0") ;; Move to the next division (setq i (1+ i)) ) ) (princ "\nInvalid entity selected. Please select a line or polyline.") ) (princ) ) Edited March 20 by SLW210 Adde Code Tags!! Quote
SLW210 Posted March 20 Posted March 20 Please use Code Tags for your code. (<> in the editor toolbar) Quote
BIGAL Posted March 20 Posted March 20 Not sure divide is the way to go as your placing chairs on an arc that changes radius as you go rather you need some maths to check does a chair box touch another box ? If so the spacing along arc needs to be increased. You can use a VL Getpointatdist function to work out spacing. May need to draw rectangs 2 off then check do they touch if yes do again and increase spacing, if the chair arms cross when installing some one will not be happy. Quote
Steven P Posted Friday at 10:08 AM Posted Friday at 10:08 AM Just wondering how many churches you lay out like this. If it is just the one I would be tempted to fill the rows with a basic polar array, probably quicker than writing and testing a LISP. If you are doing this multiple times then LISP makes sense though 1 Quote
rlx Posted Friday at 12:38 PM Posted Friday at 12:38 PM you may also consider using a simple block first , just a rectangle , that way routine might run faster. After you're done , replace simple blocks with actual 3D chairs. 1 Quote
Cadmando- Posted Sunday at 09:25 AM Author Posted Sunday at 09:25 AM I have tried the array command, but i am just learning Lisp. It one point I tried using AI program to help right the lisp routine. Just trying to get the most chairs in the Sanctuary as possible. I have drawing the lower Sanctuary few times and just thought someone could help me with writing code. After 4 temps to get max chairs, ya wrist is getting tiered. tried script file, but to pause for select arc and number of segments! Quote
BIGAL Posted Sunday at 09:50 PM Posted Sunday at 09:50 PM In terms of a lisp you would insert 2 blocks and check do they touch if so widen spacing if not narrow spacing then insert multiple blocks. Quote
CyberAngel Posted Tuesday at 07:23 PM Posted Tuesday at 07:23 PM Is there a geometric solution? Draw a triangle with the (very) short leg representing the width of the chair. By varying the length of the long legs, you can draw an arc to fit the layout line. Divide the length of that arc into the space available, round it down, and you have the number of chairs that will fit. From there it's a simple polar array insert. Repeat as necessary. 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.