Author Topic: Update SECTIONPLANE with lisp  (Read 5345 times)

0 Members and 1 Guest are viewing this topic.

kruuger

  • Swamp Rat
  • Posts: 637
Update SECTIONPLANE with lisp
« on: August 13, 2012, 07:53:08 AM »
hello

is there any method to automatically auto update all sections (blocks) genereted by _SECTIONPLANE command ?
clicking on every section/right click/generate is very annoying  :x

thanks
kruuger

RolandOrzabal

  • Newt
  • Posts: 86
  • "memories fade but the scars still linger"
Re: Update SECTIONPLANE with lisp
« Reply #1 on: August 13, 2012, 08:05:29 AM »
hello

is there any method to automatically auto update all sections (blocks) genereted by _SECTIONPLANE command ?
clicking on every section/right click/generate is very annoying  :x

thanks
kruuger

agree! i find it annoying too :)
hopefully there is...
"memories fade but the scars still linger"

togores

  • Guest
Re: Update SECTIONPLANE with lisp
« Reply #2 on: August 13, 2012, 05:42:03 PM »
Maybe this could help. The sectioned object must be a solid as the ActiveX GenerateSectionGeometry does not accept Surfaces or Meshes.
Code: [Select]
(defun c:sect-gen  (/ ss i)
  (prompt "\nSelect Section objects: ")
  (setq ss (ssget '((0 . "SECTIONOBJECT")))
        i  0)
  (while (setq sec (ssname ss i))
    (setq sec (vlax-ename->vla-object sec)
          pt1 (vlax-safearray->list
                (vlax-variant-value (vla-get-coordinate sec 0)))
          pt2 (vlax-safearray->list
                (vlax-variant-value (vla-get-coordinate sec 1))))
    (if (setq ssol (ssget "_C" pt1 pt2 '((0 . "3DSOLID"))))
      (progn (setq obj-3dsol
                    (vlax-ename->vla-object (ssname ssol 0)))
             (vla-GenerateSectionGeometry
               sec obj-3dsol 'BoundaryObjs 'FillObjs
               'BackGroundObjs 'ForegroundObjs 'CurveTangencyObjs)
             (setq i (1+ i))))))

kruuger

  • Swamp Rat
  • Posts: 637
Re: Update SECTIONPLANE with lisp
« Reply #3 on: August 19, 2012, 03:30:24 PM »
Maybe this could help. The sectioned object must be a solid as the ActiveX GenerateSectionGeometry does not accept Surfaces or Meshes.
Code: [Select]
(defun c:sect-gen  (/ ss i)
  (prompt "\nSelect Section objects: ")
  (setq ss (ssget '((0 . "SECTIONOBJECT")))
        i  0)
  (while (setq sec (ssname ss i))
    (setq sec (vlax-ename->vla-object sec)
          pt1 (vlax-safearray->list
                (vlax-variant-value (vla-get-coordinate sec 0)))
          pt2 (vlax-safearray->list
                (vlax-variant-value (vla-get-coordinate sec 1))))
    (if (setq ssol (ssget "_C" pt1 pt2 '((0 . "3DSOLID"))))
      (progn (setq obj-3dsol
                    (vlax-ename->vla-object (ssname ssol 0)))
             (vla-GenerateSectionGeometry
               sec obj-3dsol 'BoundaryObjs 'FillObjs
               'BackGroundObjs 'ForegroundObjs 'CurveTangencyObjs)
             (setq i (1+ i))))))
thanks for interesting. this one generates section from solid.
my goal is to update already inserted section (block) generated by sectionplane command.
each section (block) is connected with section plane. there are dozen of them.

kruuger

togores

  • Guest
Re: Update SECTIONPLANE with lisp
« Reply #4 on: August 22, 2012, 03:21:28 AM »
my goal is to update already inserted section (block) generated by sectionplane command.
each section (block) is connected with section plane. there are dozen of them.
Maybe you could post a sample DWG of how is this "connection" made.
Haven't done it before, but... maybe.

kruuger

  • Swamp Rat
  • Posts: 637
Re: Update SECTIONPLANE with lisp
« Reply #5 on: August 22, 2012, 03:44:35 AM »
my goal is to update already inserted section (block) generated by sectionplane command.
each section (block) is connected with section plane. there are dozen of them.
Maybe you could post a sample DWG of how is this "connection" made.
Haven't done it before, but... maybe.
hello togores
please see sample file. there are two sections.
1. click one of them
2. right click Generate 2d/3d
3. create button
you should see how section change
repetaing 1-3 is very tiring  :-(

thanks
kruuger

togores

  • Guest
Re: Update SECTIONPLANE with lisp
« Reply #6 on: August 23, 2012, 01:48:19 PM »
Hi kruuger, I've been looking at it, but the SECTION object's ActiveX stuff seems to be a bit buggy... There is a property in the AcadSectionTypeSettings where the linked section block should appear (DestinationBlock), but I haven't been able to get or put the destinaton block in it. However, the section does have this reference as we can see exploring the entity lists through entget (retrieving its settings entity).
There could be a simpler way when doing this by programming: making a group with the generated geometry entities giving it a name that you can identify later.
Nevertheless, maybe some other swamper with more experience with this kind of object could help.

mkweaver

  • Bull Frog
  • Posts: 352
Re: Update SECTIONPLANE with lisp
« Reply #7 on: September 06, 2012, 02:37:59 PM »
This will get the entity name for the block insertion that is associated with a sectionobject:

Code: [Select]
(cdr
   (assoc
     331
     (entget
       (cdr
         (assoc
           360
           (entget SectionObjectEName)
         )
       )
     )
   )
 )

togores

  • Guest
Re: Update SECTIONPLANE with lisp
« Reply #8 on: September 07, 2012, 07:23:05 AM »
This will get the entity name for the block insertion that is associated with a sectionobject:
Have you succeeded in assigning it to the DestinationBlock property?

mkweaver

  • Bull Frog
  • Posts: 352
Re: Update SECTIONPLANE with lisp
« Reply #9 on: September 10, 2012, 12:31:39 PM »
This will get the entity name for the block insertion that is associated with a sectionobject:
Have you succeeded in assigning it to the DestinationBlock property?
I haven't tried that yet. So far I have made that assignment with the built in command, then used code to put the block and sectionplane into a group.