Notifications
Clear all

[Closed] open edges of an face selection

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.

7 Replies

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

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

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

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.

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

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.

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