Author Topic: How to cut an 3D solid with a profile line?  (Read 5888 times)

0 Members and 1 Guest are viewing this topic.

CADwoman

  • Guest
How to cut an 3D solid with a profile line?
« on: May 03, 2006, 09:48:26 AM »
Hello all, does anyone know if there is a LISP tool out there that can help me cut a 3D solid with a 2D profile line? I've been playing around with Microstation and one of the really nice 3D operations was to be able to cut a 3D solid using a line. Another words you pick the solid then define a 2D line or closed polyline and then it would project the profile though the 3D solid. Any help would be appreciated.

Rob_Kish

  • Guest
Re: How to cut an 3D solid with a profile line?
« Reply #1 on: May 03, 2006, 10:12:20 AM »
Either SLICE or SECTION AutoCad commands will do the job. If you have only a line (e.g. two points) you must create a third ... like offset one of the endpoints in the plane normal (Z, presumably) direction.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: How to cut an 3D solid with a profile line?
« Reply #2 on: May 03, 2006, 10:34:30 AM »
I use slice, when it tells me to pick 3 points, pick your 2 endpoints of the line , and type @0,0,1 for third point.  The 3rd point is based on the 1st point to set up the vertical plane.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Tramber

  • Guest
Re: How to cut an 3D solid with a profile line?
« Reply #3 on: May 03, 2006, 10:43:34 AM »
if you want to perform an operation with a closed polylign, then use such a macro :
Code: [Select]
^C^C_select \_extrude p;;1e8 0 (sorry, I don't know if it's correct for US measurment. itdoesn't(modified) creates an object below Z=0

then it is easy to _SUBTRACT or _INTERSECT with L like last object created or to grow the button code if you wish, I can help.
« Last Edit: May 03, 2006, 01:15:25 PM by Call me Bert' »

CADwoman

  • Guest
Re: How to cut an 3D solid with a profile line?
« Reply #4 on: May 03, 2006, 11:21:03 AM »
The only option that actually did what I want was slicing with a 2 point 2d polyline. If you use a circle, arc, ellipse or 2D spline, it would just slice it along its co-plane as opposed to its projection. Does that make sense?

Tramber

  • Guest
Re: How to cut an 3D solid with a profile line?
« Reply #5 on: May 03, 2006, 01:18:28 PM »
Well, slicing is easy with all the options. Moving or rotating the UCS allows to obtain fast results, especially with the XY,YZ or XZ options because 1 point is enough.

Are you on a version below 2007 ?

CADwoman

  • Guest
Re: How to cut an 3D solid with a profile line?
« Reply #6 on: May 03, 2006, 04:12:25 PM »
Yes, I am using 2007.

Well, slicing is easy with all the options. Moving or rotating the UCS allows to obtain fast results, especially with the XY,YZ or XZ options because 1 point is enough.

Are you on a version below 2007 ?

qjchen

  • Bull Frog
  • Posts: 285
  • Best wishes to all
Re: How to cut an 3D solid with a profile line?
« Reply #7 on: May 15, 2006, 11:45:55 PM »
This is my program to cut a cone to get the parabolic line. I am not sure whether it is useful for you.
Code: [Select]

(defun c:test ()
  (vl-load-com)
  (setq *acad-object* nil)
  (setq *active-document* nil)
  (setq *model-space* nil)
  (setq ratio (getreal "\n y=kx^2 k=?:"))
  (setq vl-p1 (vlax-3d-point '(0 0 0)))
  (setq vl-p2 (vlax-3d-point '(1000 0 0)))
  (setq vl-p3 (vlax-3d-point '(1000 1000 0)))
  (setq vl-p4 (vlax-3d-point '(0 0 -500)))
  (setq vl-p5 (vlax-3d-point (list 0 0 (/ 0.5 ratio))))
  (setq mycone (vla-addcone (model-space) vl-p1 1000 1000))
  (vla-move mycone vl-p1 vl-p4)
  (vla-rotate3d mycone vl-p1 vl-p2 (/ pi 4))
  (vla-move mycone vl-p1 vl-p5)
  (setq cur (vla-sectionsolid mycone vl-p1 vl-p2 vl-p3))
  (vla-erase mycone)
  (vla-explode cur)
  (setq a (ssget "X" '((-4 . "<OR") (0 . "region")
          (0 . "line")
          (-4 . "OR>")
         )
      )
  )
  (command "erase" a "")
)

(defun acad-object ()
  (cond
    (*acad-object*)
    (t
      (setq *acad-object* (vlax-get-acad-object))
    )
  )
)


(defun active-document ()
  (cond
    (*active-document*)
    (t
      (setq *active-document* (vla-get-activedocument (acad-object)))
    )
  )
)


(defun model-space ()
  (cond
    (*model-space*)
    (t
      (setq *model-space* (vla-get-modelspace (active-document)))
    )
  )
)
http://qjchen.mjtd.com
My blog http://chenqj.blogspot.com (Chinese, can be translate into English)

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: How to cut an 3D solid with a profile line?
« Reply #8 on: May 16, 2006, 12:37:37 AM »
As bert' mentioned, to cut a solid with the profile of a polyline you first need to create a solid from the 'closed' polyline, ie. extrude it deep enough to pass through your object to be cut. Then you simply SUBTRACT the new solid from the cutting object.
When doing this, make sure your cutting polyline is in the correct plane and you may need to give it a negative height value, you will see this after extrusion anyway and with a bit of practice you'll get the hang of it and from here you could contruct your lisp routine to perform the cuts automagically.
Rob's idea for cutting with a line is the best way to go, grab one of your lines points and change its 'z' value to give you another point to create a plane from the line to cut your object. The user will soon work out that a correct ucs is required when using this routine to achieve the correct result.
hth,
Mick.
« Last Edit: May 16, 2006, 12:43:25 AM by MickD »
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien