[Closed] spline dirction axis convertto mesh face
for help :
get a shape or spline from the object , and the shape`s direction or normal (i dont know how to say it) is inherit the object, if i convert the shape (closed shape) to mesh . and normally it will convert to a face object . but sometimes it cant create a face object . maybe nothing created .
i try to use extrude to the shape , most of shape will create a boxlike object (like a building), but some of it is lean , not upstraight. i think it maybe something about pivot , so i write a script to correct the pivot z axis up straight from the line plain . but after extrude , it still lean .
i think this is why i convert the shape to mesh , and get nothing .
maybe the shape has any hide axis for convert to mesh and create a face object ?
is here no one know how to do or my explain is not good for understand ?
or the object has any secret pivot or axis for face creating from any spline ?
waiting for any help reply , thanks .
Do you want to extrude your spline along the World Z axis instead of the face normal ?
The modifier extrude does not seem to have this kind of controls over the direction of the extrusion.
You have probably to re-write the extrusion to have these controls.
An alternative will be to use the extrusion and to modify the position of points later… avoid creating the faces but there is disadvantages also. (to find the points which correspond…)
It is not so difficult to re-write the extrusion:
The steps are something like this:
- find the order of the outline vertices
- detach the faces
- move the faces along the direction of the extrusion
- create the new faces (by using the same order than the original outline of the vertices)
I already programmed the function to find the outline.
So I write a little test. Just for editables polys.
Of course it’s not optimized because I use an old structure.
struct vectorizedOutline
(
edges=#(),
verts=#(),
vertsPos=#(),
thisOp,
getType,
fn initType classOfObj =
(
case classOfObj of
(
Editable_Poly: ( getType=1 ; thisOp=polyOp )
PolyMeshObject: ( getType=1 ; thisOp=polyOp )
Editable_mesh: ( getType=2 ; thisOp=meshOp )
)
),
fn getFirstItem theBitArray = (
local retValue=0
if theBitArray.numberset==0
then retValue=0
else (
if theBitArray[1]
then retValue=1
else (
local maxIdx=theBitArray.count
for i=1 to maxIdx while not theBitArray[i] do retValue=i
retValue+=1
)
)
retValue
),
fn getOutline obj theFaces = (
initType (classof obj)
local retVal=false
local faceEdges=thisOp.getEdgesUsingFace obj theFaces
local outlineEdges=#{}
for e in faceEdges where (((polyOp.getFacesUsingEdge obj e)*theFaces).numberSet == 1) do outlineEdges[e]=true
outlineEdges
),
fn vectorizeEdgeList obj theEdges = (
local edgesString=#()
local vertsString=#()
local vertsPosString=#()
if theEdges.numberset!=0 do (
local deadEdges=#{}
local nextEdgeBA, nextEdge=getFirstItem theEdges
local currentVerts=thisOp.getVertsUsingEdge obj #{nextEdge}
local firstVert=getFirstItem currentVerts
local nextVert=getFirstItem (currentVerts-#{firstVert})
append edgesString nextEdge
append vertsString firstVert
append vertsPosString (thisOp.getVert obj firstVert)
local cond=true
while cond do (
local currentEdge=nextEdge
currentVerts=thisOp.getVertsUsingEdge obj #{currentEdge}
local nextVert=getFirstItem (currentVerts-#{firstVert})
deadEdges[currentEdge]=true
append vertsString nextVert
append vertsPosString (thisOp.getVert obj nextVert)
local currentVertEdges=thisOp.getEdgesUsingVert obj nextVert
nextEdgeBA=((currentVertEdges*theEdges)-deadEdges)
if nextEdgeBA.numberset<1
then cond=false
else (
nextEdge=getFirstItem nextEdgeBA
append edgesString nextEdge
firstVert=nextVert
)
)
)
edges=edgesString
verts=vertsString
vertsPos=vertsPosString
vectorizedOutline edges:edgesString verts:vertsString vertsPos:vertsPosString
),
fn getVertsOrder obj theFaces = (
local theOutline=getOutline obj theFaces
local vel=vectorizeEdgeList obj theOutline
vel.verts
)
)--struct
fn subFinder array theVal = (
for eIdx=1 to array.count do (
local e=array[eIdx]
local idx = findItem e theVal
if idx!=0 do return #(eIdx,idx)
)
)
fn extrudeFaces obj theFaces theDir theLength= (
--find the order of vertices
local v=vectorizedOutline()
local vertsOrder=v.getVertsOrder obj theFaces
--store original structure
local faceStructBefore=for f in theFaces collect polyOp.getFaceVerts obj f
--detach the faces
polyOp.detachFaces obj theFaces delete:true
--store the new structure
local faceStructAfter=for f in theFaces collect polyOp.getFaceVerts obj f
--move along vector
local moveVect=(normalize theDir)*theLength
local allVerts=polyOp.getVertsUsingFace obj theFaces
for v in allVerts do ( polyOp.setVert obj v (polyOp.getVert obj v + moveVect) )
--find the links (find which point corresponds to the original point)
local extrudedVertsOrder=#()
for v in vertsOrder do (
local subPos=subFinder faceStructBefore v
append extrudedVertsOrder faceStructAfter[subPos[1]][subPos[2]]
)
--create faces
for idx=1 to (vertsOrder.count-1) do (
local p1=vertsOrder[idx]
local p2=vertsOrder[idx+1]
local p3=extrudedVertsOrder[idx+1]
local p4=extrudedVertsOrder[idx]
polyOp.createPolygon obj #(p1,p2,p3,p4)
)
)--fn
(
local obj=selection[1]
local theFaces= polyOp.getFaceSelection obj
extrudeFaces obj theFaces [0,0,1] 100.0
)
It is not finished: if you extrude the faces of the border, there is no vertex duplicated during the detach step. This function works only with an inner selection.
I hope that this code will give you nevertheless ideas to continue…
i will backup the code . thanks .
it looks a little complex for me now .
thanks .
Hi,
just a couple of points:
to successfully collapse a shape to an object there are two main rules:
1/ the shape must be closed.
2/ the shape must not self-intersect.
To reset an objects transform, use the ‘reset transform’ tool under the utilies tab.
Cheers,
Josh.