Author Topic: section plane to block within lisp  (Read 864 times)

0 Members and 1 Guest are viewing this topic.

nekonihonjin

  • Newt
  • Posts: 103
section plane to block within lisp
« on: September 01, 2022, 01:15:17 PM »
Hey guys, I fond this code and changed it to create section planes from lines.

Code: [Select]
(defun c:mksectionp ( / ss i )

(prompt "\nSelect lines to create section planes: ")
(setq ss (ssget (list (cons 0 "LINE")))
       i  0)

(while (setq obj (ssname ss i))

  (setq p1 (vlax-curve-getendpoint obj))
  (setq p2 (vlax-curve-getstartpoint obj))
  (setq v1 '(0 0 1));Plane Vector - (0 0 1) is straight up
  (setq *acad* (vlax-get-acad-object));Get the ACAD object
  (setq *ad* (vlax-get-property *acad* 'ActiveDocument));Get the Active Document
  (setq *ms* (vlax-get-property *ad* 'ModelSpace));Get the Model Space
  (setq section-object (vlax-invoke-method *ms* 'AddSection (vlax-3d-point p1)(vlax-3d-point p2)(vlax-3d-point v1)))
  (setq i (1+ i))

)

(princ)
)

I have been searching in google and in forums, but I have not found a way to pass these sections to block (like using the "sectionplanetoblock" command), with the help of a lisp, without the dialog box showing up to configure it, and several planes at a time.

I read that there is a function "vla-GenerateSectionGeometry" but nowhere can I find information on how to use it or what parameters to set.

I wonder if any of you know how this can be accomplished?





BIGAL

  • Swamp Rat
  • Posts: 1410
  • 40 + years of using Autocad
Re: section plane to block within lisp
« Reply #1 on: September 01, 2022, 10:20:56 PM »
Maybe a start http://entercad.ru/acadauto.en/

Look in the search box for GenerateSectionGeometry
A man who never made a mistake never made anything

nekonihonjin

  • Newt
  • Posts: 103
Re: section plane to block within lisp
« Reply #2 on: September 02, 2022, 12:42:37 PM »

Still need to press space bar then "C" for every block to be created, not perfect, but I guess I'll have to settle for that

Code: [Select]
(defun c:batchsec  (/ ss i pt xcord newx ycord zcord )
  (prompt "\nSelect section planes: ")
  (setq ss (ssget '((0 . "SECTIONOBJECT")))
        i  0
        pt (getpoint "\nPick insertion point: ")
       sep (getreal "\nspacing between blocks: "))
   (while (setq sec (ssname ss i))
      (progn
         (command "_sectionplanetoblock" sec pt "1" "1" "0")
         (setq i (1+ i)
               xcord (car pt)
               newx (+ sep xcord)
               ycord (cadr pt)
               zcord (caddr pt)
               pt (cons newx (cons ycord (cons zcord nil))))
      )
   )
 (princ)
)


« Last Edit: September 03, 2022, 01:55:34 AM by nekonihonjin »