Notifications
Clear all
[Closed] Create shape from edge
Mar 05, 2008 1:43 am
Hi,
I'm looking for a way to emulate the meshOp "create shape from edge" and i'm only allowed to work in mesh, so polys are not an option.
I understand i can call " meshOps.[b][b]createShapeFromEdges[/b][/b] ", and the dialog will popup, but since i am doing this several times, having a dialog continually popup would be annoying.
Currently i am taking an edge selection, getting the verts from those edges, and then using those vert coordinates as coordinates for my spline knots.
I haven't really worked with Splines, so much of the spline code i wrote was stitched together from samples i saw on here.
sample of my code:
Vert_array = #() ; obj = $
selectedEdges = getEdgeSelection obj
EdgeVerts = meshop.getVertsUsingEdge obj selectedEdges
for vert in EdgeVerts do
(
Vert_array[Vert_array.count + 1] = ( meshop.getVert obj vert )
)
-- Create shape -------------------------------------
new_spline = splineShape()
Spline_index = addNewSpline new_spline
for knot_pos in Vert_array do
(
addKnot new_spline Spline_index #corner #line knot_pos
)
close new_spline 1
updateShape new_spline
This code works fine when the verts of my mesh are clean and go in order, but as soon as they don't go in order, i start getting unexpected results.
Example: a mesh containing typology with verts aligning like this
" vert01, vert02, vert03 " : works fine
but when they align like this
" vert09, vert 255, ver 67 " : is when i am getting problems.
If anyone could lead me in the right direction it would be appreciated. Do i have options, or is having the dialog pop up the best solution?
Thanks
2 Replies
Mar 05, 2008 1:43 am
actually thats what i had to end up doing, i had to sort the verts using the edges as a reference, kind of ugly but only solution that we came up with currently.