Jump to content

Recommended Posts

Posted (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 by SLW210
Adde Code Tags!!
Posted

Please use Code Tags for your code. (<> in the editor toolbar)

Posted

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.

Posted

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

  • Agree 1
Posted

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.

  • Like 1
Posted

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!

  

Posted

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.

Posted

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...