PDA

View Full Version : Selecting edge, holding shift and moving.


IckisMonster
01-19-2007, 03:57 PM
Hi,

Normally the specified action in the subject creates a new edge and position from a previously selected edge. I'm trying to do this in maxscript... with difficulty... I wonder if anybody could have a look at it for me please?


startPlane=Plane length:10 width:10 lengthsegs:1 widthsegs:1
rotate startPlane (eulerangles 90 0 0)
select startPlane
macros.run "Modifier Stack" "Convert_to_Poly"

createEdgeFromEdge 1 true [-10, 0, 5] true [-10, 0, -5]


--This creates a new edge from a certain source edge. We need this because when we are normally
--modelling, we can hold shift when we move an edge to create a new one. However, maxscript does
--not appear to have this functionality very easily.
fn createEdgeFromEdge sourceEdgeNum newVertex1PosAbsolute newVertex1Pos newVertex2PosAbsolute newVertex2Pos=(

--Get vertices index for the the source edge.
vertex1_Index=$.EditablePoly.GetEdgeVertex sourceEdgeNum 1
vertex2_Index=$.EditablePoly.GetEdgeVertex sourceEdgeNum 2

--Get vertices
vertex1=$.EditablePoly.GetVertex vertex1_Index
vertex2=$.EditablePoly.GetVertex vertex2_Index

--Switch to vertex selection.
subobjectLevel=1

--Select vertex1.
$.EditablePoly.SetSelection #Vertex #{vertex1_Index}

--See if we are moving vertex1 to an absolute position.
if newVertex1PosAbsolute==true then(

--Move vertex1 to new position.
$.selectedVerts[1].pos=newVertex1Pos
)else(

--Move vertex1 to new position.
$.selectedVerts[1].pos=$.selectedVerts[1].pos+newVertex1Pos
)

--Select vertex2.
$.EditablePoly.SetSelection #Vertex #{vertex2_Index}

--See if we are moving vertex2 to an absolute position.
if newvertex2PosAbsolute==true then(

--Move vertex2 to new position.
$.selectedVerts[1].pos=newVertex2Pos
)else(

--Move vertex2 to new position.
$.selectedVerts[1].pos=$.selectedVerts[1].pos+newVertex2Pos
)
)


What I'm doing is currently moving the existing edge to the new edge place; but the way I'm doing it seems a bit untidy. Also, I'm struggling on how to 'cut' where the old edge was.

Thanks,
IM.

CGTalk Moderation
01-19-2007, 03:57 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.