Author Topic: Removing blank section blocks  (Read 2033 times)

0 Members and 1 Guest are viewing this topic.

zride91

  • Guest
Removing blank section blocks
« on: January 12, 2012, 03:39:40 PM »
I am curious if this is even possible, at this point it seems to be WAY over my head.  I'm working with Revit Exports to AutoCAD, and I'm trying to use a script and lisps to clean the DWGs up after the export.

I just love how well Autodesk products work with other Autodesk products...

My problem is that my designers in Revit have all these sections cut all over the place that do not get referenced into a sheet, they are just used for working/design purposes.  When we print the Revit sheets, there is an option in Revit to ignore printing the section marks that are not referenced into sheets, so it is not a big deal to just leave them (until you export to DWG).
Now in my exported AutoCAd files, I have all these section marks with hyphens in them, all over the place.  Of course the hyphens are not attributes in the section marker block, they are MTEXT seperate from teh sectiom mark block.

Anyone think that there even could be a way through lisp to search the MODEL for the section blocks, and see if there is MTEXT with "---" AND MTEXT with "-" within the area of the circle part of the block, then if found delete that instance of the section block AND the "-" and "---", then go on searching the model for more??

Thank you

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Removing blank section blocks
« Reply #1 on: January 12, 2012, 03:45:37 PM »
You have an example file to upload?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

zride91

  • Guest
Re: Removing blank section blocks
« Reply #2 on: January 12, 2012, 03:57:20 PM »
Absolutely.  Thanks for the interrest.
In Model space, you'll see the section mark blocks, about half have just "-" and "---" in the bubble.  The section marks with valid plan and drawing numbers I want to keep.

Thank you!

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Removing blank section blocks
« Reply #3 on: January 12, 2012, 05:57:16 PM »
Looks like you lucked out, all the objects are linked with xdata  8-). Give this a whirl.

Please test it thoroughly :)

Code: [Select]
(defun c:deletedash (/ ss2lst _getxdlink cya ss ss2 x)
  (defun _getxdlink (e / el)
    (if e
      (if (setq el (entget e '("Revit")))
(cdr (assoc 1000 (cdadr (assoc -3 el))))
      )
    )
  )
  (defun ss2lst (ss / e n out)
    (setq n -1)
    (if ss
      (while (setq e (ssname ss (setq n (1+ n)))) (setq out (cons e out)))
    )
  )
  (if (and (setq ss (ss2lst (ssget "_x" '((0 . "*text") (1 . "*-,*---") (-3 ("Revit"))))))
   (setq ss2 (ss2lst (ssget "_x" '((0 . "~*text") (-3 ("Revit"))))))
   (setq cya (mapcar '(lambda (x) (_getxdlink x)) ss))
      )
    (progn (foreach e ss (entdel e)) (foreach e ss2 (and (member (_getxdlink e) cya) (entdel e))))
  )
  (princ)
)
« Last Edit: January 12, 2012, 06:02:31 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

zride91

  • Guest
Re: Removing blank section blocks
« Reply #4 on: January 12, 2012, 06:35:18 PM »
ronjonp, you are officially my idol right now.  THANK YOU SO MUCH!!

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Removing blank section blocks
« Reply #5 on: January 12, 2012, 07:14:49 PM »
Glad you could use it. Welcome to the swamp.  :-)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC