Back to plugins

Knife for AC3D

Released under the GNU LESSER GENERAL PUBLIC LICENSE.

Latest release (version 1.3)
NOTE: Version 1.3 is in Alpha testing
Download Windows version 1.3
Download Linux (Debian) version 1.3*
Download Linux (RedHat) version 1.3**
Download source code 1.3

Previous release (version 1.1.2)
Download source code for previous release (1.1.2)

* NOTE: Courtesy of AJ MacLeod, the Linux version was compiled and linked on a Debian 3.0 install. If this does not work for you, the source code has been proven to compile/link under Linux, so you may wish to download the source code and compile for your system.

**NOTE: Courtesy of Eldon Brown. From the enclosed Readme:
This port of "knife" was compiled on RedHat 7.3 with gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-113).
It has been tested and known to work using "ac3ds" (ac3d static) on RedHat 7.3 and Fedora 3.0
To install; copy "knife.p" and "knife.tcl" to the ac3d plugin directory, then restart ac3d.

Fixes in version 1.3:
  • Slices are performed by surface. If a knife has more than one surface, the knife performs slices one surface at a time. This produces more predictable/natural results, especially when slicing multiple times on a single edge.

Fixes in version 1.2.2:

  • When the Knife intersects an object on top of an existing vertex, the existing vertex is now added as a slice/cut-away candidate. Before, existing vertices that intersected the knife were not considered for slicing/cutting away.

Fixes in version 1.2.1:

  • Fixed bug in "cut away surfaces" --- version 1.2 created too many objects in cut aways when multiple objects were cut at once.
  • Generates more appropriate warning/error message when Object Select mode is not active when specifying a Knife object.

Fixes in version 1.2:

  • Fixed "cut away surfaces" in the Linux version (many thanks to Andy Colebourne and AJ MacLeod).

Fixes in version 1.1.2:

  • Introduced source code courtesy of AJ MacLeod to allow compilation under Linux.
  • Texture coordinates for new vertices on sliced surfaces are correctly mapped.

Improvements made in version 1.1:

  • Multiple cuts per edge now performed
  • New surfaces created by the knife now take on all attributes of replaced surfaces (1/2 sided, etc)
  • Undo is more efficient

Known issues and Limitations:

  • Slicing many edges (tens of thousands) can be very slow due to the process of gathering edges.
  • Slicing occurs on a per-surface basis. If your knife object has multiple surfaces, you will not get slices in your geometry between separate surfaces.


Acts on the edges of the selected objects/surfaces, inserting a vertex where necessary. Optionally performs a Slice Surface.

This plugin and code are freely distributable

AC3D versions prior to version 5 have not been tested with this script.

The interface options are as follows:

1 Set knife Establishes the knife object. The knife object is an AC3D object that will be used to determine where to insert vertices. Any place the knife objects intersects the geometry to be "sliced", a vertex will be inserted (see below for caveats).
2 Slice surfaces If this option is not checked, then vertices will be inserted where the knife object intersects the edges of the target geometry. If this option is checked, a "slice surface" will be performed as well (see the AC3D manual for "slice surface" under vertex commands. NOTE: the function here emulates the Vertex | Slice Surface command, but is a customized version of it.
3 Cut away object If checked, all selected surfaces in "front" of or "outside of the knife will be separated into their own object(s). This uses the AC3D feature "Surface | Cut away object".
4 Delete knife If checked, the knife object will be deleted after the slice is performed.
5 Slice Slices the edges of the selected shape using the knife set with "Set knife".

Description

Knife is an AC3D plugin that allows you to insert vertices (and optionally slice surfaces) in the selected object(s).

Installation

Copy the knife.tcl and knife.p files to your AC3D plugins folder (for example, if using Windows, C:\Program Files\AC3D5\plugin) and (re)start AC3D.

You will find the "Knife..." menu item under the "Tools" menu.

Example : Slicing a sphere with a cutting plane

In this example we'll slice a sphere across an arbitrary plane.

First, create a sphere with a fairly high density - I used 48. Then, create a rectangle that completely intersects the sphere at an angle. I created a rectangle on the "top" view that completely enclosed the top view of the sphere, then rotated the rectangle 35 degrees.

We'll slice the sphere where it is intersected by the rectangle, then delete the rectangle. To do this, perform the following steps:

1. Select the "Knife..." menu item under the "Tools" menu. This brings up the Knife interface.

2. Select the rectangle object and click "Set knife" to make the rectangle your knife object.

3. Ensure that "Slice surfaces", "Cut away object", and "Delete knife" are all checked. "Slice surfaces" will cause all of the edges of the sphere than intersect the plane to be sliced where they meet. "Cut away object" will cause the sphere to be split into two objects. "Delete knife" will cause the rectangle to be deleted.

4. Select the sphere and click "Slice".

If you followed these steps, you should end up with two halves of a sphere, below.

IGNORE THE SURFACES INDICATED BY THE RED ARROW: This points out a legacy problem where surfaces were not sliced properly (old attributes were not kept, such as 1/2 sided, material, etc - only geometry). This has been addressed/fixed in the latest version. These screenshots have not yet been updated to reflect the new fixes.

Example : Slicing a sphere with a shape

You can use any single object as a knife. Here, we'll try a cylinder. Using the same sized sphere as before, this time create a cylinder that passes through the entire sphere like so:

Repeat the same steps as with the rectangle slice in the previous example, only using the cylinder as the knife object.

The cut-away surfaces will be those "outside" or "in front of" the cylinder's surfaces. You can see which way a surface faces by showing Normals --- try showing normals in the 3D view (by pressing the "n" key while the mouse is in the 3D view). You'll see lines coming from the surfaces indicating which way the surfaces face. The knife tool separates surfaces "outside" or "in front of" the knife object from those "inside" or "behind" the knife object.

If you followed the same steps, you should end up with something like this.

Back to plugins



All content Copyright © 2006 Dennis Hawthorne, except where explicitly noted
supercoldmilk © 2006 Dennis Hawthorne