PDA

View Full Version : open edges of an face selection


prettyPixel
03-26-2005, 11:14 AM
Anybody know the way of finding the openEdges of an face selection ?
I have to program something very similar in the function polyOp.getOpenEdges but of a face selection and I don't know the used principle...

I'll be thankful for any answer.

Light
03-26-2005, 01:37 PM
Hi, maybe this does what you need:

local sel = selection[1].baseObject

local faceEdges = polyOp.getEdgesUsingFace sel (polyOp.getFaceSelection sel)

polyOp.setEdgeSelection sel (for i in faceEdges where ((polyOp.getFacesUsingEdge sel i).numberSet == 1) collect i)

subObjectLevel = 2




Light

prettyPixel
03-26-2005, 03:31 PM
no :o) But it is a good try, very elegant.
That cannot work because of the function polyOp.getFacesUsingEdge which works on all the object. So the result is not the outline of the selection, just a part of it.

but Thanks for the answer ;)

Light
03-26-2005, 03:44 PM
I don't understand. Do you want to select outline edges of current face selection or open edges of current face selection? If neither of them, then can you please tell more?




Light

prettyPixel
03-26-2005, 04:16 PM
Sorry, I believe that I confuse the programming terms.
I wanted to find the outline of the selection (for me it's the open edges)
but Thanks to your routine I programmed this.

fn getOpenEdgesSel obj facesArray =
(
openEdges=#{}
edgesSel=polyOp.getEdgesUsingFace obj facesArray
for currentEdge in edgesSel do
(
sharedFaces=polyOp.getFacesUsingEdge obj currentEdge
sharedFacesSel=#{}
for array1Elem in sharedFaces do ( if (findItem facesArray array1Elem!=0) do append sharedFacesSel array1Elem )
if sharedFacesSel.numberset == 1 then append openEdges currentEdge
)
openEdges
)

obj=selection[1]
selFaces=polyOp.getFaceSelection obj
outlineEdges=getOpenEdgesSel obj selFaces
polyOp.setEdgeSelection obj outlineEdges
subObjectLevel = 2
max views redraw

It is not very optimized but I do not know how to make better.
...but that select the edges :)

Thanks again for your help.

Light
03-26-2005, 04:27 PM
Ok, your code made clear. You want outline edges:

local sel = selection[1].baseObject

local faceSel = polyOp.getFaceSelection sel

local faceEdges = polyOp.getEdgesUsingFace sel faceSel

polyOp.setEdgeSelection sel (for i in faceEdges where (((polyOp.getFacesUsingEdge sel i) * faceSel).numberSet == 1) collect i)

subObjectLevel = 2




Light

prettyPixel
03-26-2005, 05:01 PM
Fantastic! Your code is 100 times more simple than mine!
It's very elegant.

I learn today the '*' operator for bitarray because of your help.

Thank you very much.

f97ao
03-28-2005, 11:54 PM
Ha, I just wrote this function for myself 1 hour ago without seeing this thread. This is the way I do to get a bitarray with open vertex/edges/faces.

fn FW_SelectionGetOpen tObject subName erase:true=
(
--Function that returns open vertex/edges/faces.
--tObject is the object, SubName is the subobjectlevel, erase decides if the new open selection should be remembered or erased.
--Example: FW_SelectionGetOpen $ #currentLevel erase:true

selOpenAnswer
if FW_TestObject tObject check:#exist class:Editable_Poly do
(
tBaseObject=tObject.baseObject
openSel=polyOp.getOpenEdges tBaseObject
if subName==#edge then
selOpenAnswer=openSel
else
(
disableSceneRedraw()
selEdge=tBaseObject.GetSelection #edge
selCurrent=tBaseObject.GetSelection subName

tBaseObject.SetSelection #edge openSel
tBaseObject.convertSelection #edge subname
selOpenAnswer=tBaseObject.GetSelection subName

if erase do
(
tBaseObject.SetSelection #edge selEdge
tBaseObject.SetSelection subname selCurrent
)
enableSceneRedraw()
)
)
return selOpenAnswer
)

I'm going to look into your code guys and see what it does. :)
/Andreas

CGTalk Moderation
03-28-2005, 11:54 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.