Jump to content

Recommended Posts

Posted

Hello everyone,

 

I'm trying to extract points/vertices from a 3D solid.

The first way I tried was by exploding it into lines and arcs and then collecting the points. This works, but it is very slow.

 

After that I found ACISdecode function by Kailas Dhage and used it to get some information about the 3D Solid.

On a lot of 3D Solid it works and extracts the points correctly. But sometimes if I move the object, the point's inside of the ACIS data don't move.

I'm trying to find where the transformation is stored so I can apply it to the exported points as well, but can't seem to find it.

 

Code to export the points below, and an example drawing attached on which it doesn't work correctly.

Hope someone can guide me in the right direction!

 

(defun c:solid->pts ( / ent enx i rtn _acis)

  (defun _acis (enx / itm lin dxf str cha rtn)
    ; ACISdecode by Kailas Dhage (kailas@uts.com)
    ; Newsgroups: autodesk.autocad.customization 1999/05/10
    ; Modified to work directly on entget data by dexus 2025/08/11
    (while (setq dxf (assoc 1 enx))
      (setq str (reverse (vl-string->list (cdr dxf)))
            itm nil lin nil)
      (while str
        (setq cha (car str) str (cdr str))
        (cond
          ((= cha 95))
          ((= cha 86) (setq itm (cons 73 itm)))
          ((= cha 32) (setq lin (cons (if itm (vl-list->string itm) "") lin) itm nil))
          ((boole 6 cha 95) (setq itm (cons (boole 6 cha 95) itm)))
        )
      )
      (setq rtn (cons (cons (if itm (vl-list->string itm) "") lin) rtn)
            enx (cdr (member dxf enx)))
    )
    (reverse rtn)
  )

  (if
    (and
      (setq ent (car (entsel)))
      (setq enx (entget ent))
    )
    (foreach i (_acis enx)

      ; Princ result of the ACIS decode
      (princ "\n") (princ (vl-prin1-to-string i))

      (if (and (equal (car i) "point") (> (length i) 5) (setq i (cddddr i)))
        (entmakex
          (list
            '(0 . "POINT")
            (cons 10
              (list
                (distof (car i))
                (distof (cadr i))
                (distof (caddr i))
              )
            )
          )
        )
      )
    )
  )
  (princ)
)

 

points.dwg

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...