See the top rated post in this thread. Click here

Results 1 to 7 of 7

Thread: Select/Delete solids by volume.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Member
    Join Date
    2008-10
    Posts
    14
    Login to Give a bone
    0

    Default Select/Delete solids by volume.

    I am having trouble with large 3d model in autocad extracted from PDMS type software that contains many small solids for representation of weld connections, bolts etc. I have an idea about a code to either filter a selection or delete objects depending on their volume( for example below 10cm3) in order to decrease the complexity of the drawing and to make it more usable. Can anybody help me?

  2. #2
    100 Club
    Join Date
    2000-11
    Location
    Ontario, Canada
    Posts
    116
    Login to Give a bone
    0

    Default Re: Select/Delete solids by volume.

    A very bare-bones example of how you might approach this:

    Code:
    (defun sm-del (minvol / )
      (vlax-for x (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))
        (if (and (= "AcDb3dSolid" (vla-get-objectname x))
                 (< (vla-get-volume x) minvol)
                 ); and
          (vl-catch-all-apply 'vla-delete (list x))
          ); if
        ); vlax-for
      ); defun
    To run, enter (sm-del m), where m is the minimum volume you wish remaining solids to have. All solids in modelspace with a volume less than m will be deleted. You could alternately place unwanted solids in a specific layer which then is turned off, or any of a number of other approaches. Hopefully, this will be of some use to you.

  3. #3
    Member
    Join Date
    2007-10
    Posts
    2
    Login to Give a bone
    0

    Default Re: Select/Delete solids by volume.

    Hi any idea to do some similar...i need a routine to select/delete duplicate 3d solid...maybe comparing first the volumen and then the centroid and put all these in a layer called TODELETE

  4. #4
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: Select/Delete solids by volume.

    Quote Originally Posted by rafael.silvav View Post
    Hi any idea to do some similar...i need a routine to select/delete duplicate 3d solid...maybe comparing first the volumen and then the centroid and put all these in a layer called TODELETE
    https://www.theswamp.org/index.php?topic=49862.0

    HTH, M.R.

  5. #5
    Member
    Join Date
    2008-10
    Posts
    14
    Login to Give a bone
    0

    Default Re: Select/Delete solids by volume.

    Thanks alot, I will give it a try and give feedback.If it works it will be great timesaver for me.

  6. #6
    Member
    Join Date
    2008-10
    Posts
    14
    Login to Give a bone
    1

    Default Re: Select/Delete solids by volume.

    It works great! Thanks a lot!

  7. #7
    Member
    Join Date
    2016-05
    Posts
    19
    Login to Give a bone
    0

    Default Re: Select/Delete solids by volume.

    this lisp will collect all the duplicate solids by volume and centroid and move them to layer to TODELETE.
    the command: CLEANSOLIDS

    Code:
    ;;;Select/delete duplicate 3d solid ... comparing SOLID volume and centroid all the match duplicates go-to layer TODELETE in red color.
    ;;;Delete solids could be activated.
    ;;;the solid volume and centroid had to be an exact match.
    
    (vl-load-com) ;;; load ActiveX support
    
    (setq *acadobj*(vlax-get-acad-object))
    (setq *doc_ly*(vla-get-activedocument *acadobj*))
    (setq *layers*(vla-get-Layers *doc_ly*))
    
    ;;;CREATE LAYER
    (defun mk:layer (name color Linetype / clay nlayer)
    (setq clay (getvar "clayer"))
    (setvar "clayer" "0")
    (setq nlayer(vlax-invoke-method *layers* 'Add name))
    (vlax-put-property nlayer 'Freeze 0)
    (vlax-put-property nlayer 'Lock 0)
    (vlax-put-property nlayer 'LayerOn -1)
    (if (= color nil)(setq color "7")(princ))
    (vlax-put-property nlayer 'color color)
    (if (= Linetype nil) (setq Linetype "Continuous") (princ))
    (vlax-put-property nlayer 'Linetype Linetype)
    (vla-Regen *doc_ly* acAllViewports)
    (setvar "clayer" clay)
    nlayer
    )
    
    ;;;OBJECT volume and centroid LIST 
    (defun ob:vl:cn (ent / vlob vol cent)
    (setq vlob(vlax-ename->vla-object ent))
    (setq vol (vla-get-Volume vlob))
    (setq cent(vlax-safearray->list(vlax-variant-value(vla-get-centroid vlob))))
    (cons (cons  vol cent) vlob )
    )
    
    (defun c:cleansolids (/ ent_list sld ssld del n ent ent_acc ent_list)
    
    (mk:layer "TODELETE" 1 NIL)
    (setq sld (ssget "_X" '((0 . "3DSOLID"))))
    (setq ssld (sslength sld))
    (setq del 0)
    (setq n 0)
      
    (repeat ssld
    (setq ent (ssname sld n))
    (setq ent_acc (ob:vl:cn ent))
    
    (if (= (assoc (car ent_acc) ent_list) nil) ;;;check the volume and centroid
    (setq ent_list (append ent_list (list ent_acc))) ;;;add the solid if the solid not in the list.
    (progn
    (vlax-put-property (vlax-ename->vla-object ent) 'LAYER "TODELETE");;;if the in the list, move the solid to layer "TODELETE"
    ;;;    (vla-delete (vlax-ename->vla-object ent))
    (setq del (1+ del))
    )
    )
    (setq n (1+ n))
    )
      
    (prompt (strcat "\n" (rtos del 2 0) " Solids Deleted"))
    
    (princ)
    
    )

Similar Threads

  1. Volume from solids
    By Wish List System in forum NavisWorks - Wish List
    Replies: 2
    Last Post: 2016-12-07, 11:25 AM
  2. 2014: Cant select / delete this line
    By b.dejong678894 in forum Revit MEP - General
    Replies: 2
    Last Post: 2015-03-26, 12:29 AM
  3. Volume of Solids
    By William.Gares in forum AutoCAD Civil 3D - General
    Replies: 13
    Last Post: 2015-02-19, 03:49 PM
  4. Volume of solids?
    By patricks in forum Revit Architecture - Families
    Replies: 0
    Last Post: 2006-08-24, 02:31 PM
  5. Fields for mass and/or volume of 3D Solids
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2006-02-07, 07:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •