ScriptSpot

Forum topic · Scripts Wanted

Select Hard Edges(the green ones)

By rartidiello · 2019-11-13

Description

Hello guys,

I need to select Hard Edges.

I saw a similar post selecting hard edges defining a minimum and maximum angle between faces but this is not what I need.

Imagine you have a 32 segment sphere converted to Editable Poly and you randomly declare 2 edges ¨Hard¨, using the Hard button on the Edit Edges rollup. You can see those edges in green if you click on Display Hard Edges, but you wont be able to automatically select them either by angle nor by change of the smoothing groups.

If there´s a way to select those green edges, that would be great.

Thanks.

Attachments
Comments (7)

.

miauu · 2019-12-02


macroscript macro_SelectHardEdges
category:"miauu"
tooltip:"Select Hard Edges"
buttonText:"Select Hard Edges"
(
	on execute do
	(
		if selection.count == 1 do
		(
			if classOf (curO = selection[1]) == editable_poly do
			(
				subobjectlevel = 2
				curO.selectHardEdges()
			)
		)
	)
)

x_OL · 2020-02-25

it work in 2020, thanks
very usefull feature

fzxj520 · 2024-08-22

How to select the edge with Crease value greater than or equal to 0.5 ?

miauu · 2024-08-23


(
	creaseVal = 0.5
	poGetEDataValue = polyop.getEDataValue
	if classof (obj = selection[1]) == Editable_Poly do
	(
		
		numEdges = polyop.getNumEdges obj
		edgToSelBA = #{}
		for i = 1 to numEdges where (poGetEDataValue obj 2 i) >= creaseVal do edgToSelBA += #{i}
		
		max modify mode
		subobjectlevel = 2
		polyop.setEdgeSelection obj edgToSelBA
		redrawViews()
	)
)

fzxj520 · 2024-08-25

Thank you very much, it's great!
Can you make it work for Edit Poly Modifier too?

I tried to replace the corresponding Edit_Poly code, but I couldn't find it in MAXScript Help.

My modified script ‘ Quick Set Edge crease ’
( obj = modPanel.getCurrentObject() if obj != undefined then
(
case (classof obj) of
(
Edit_Poly:
( obj.setOperation 86 ; obj.dataChannel = 1 ; obj.dataValue = 1 ; obj.Commit ())
Editable_Poly:
( obj.setEdgeData 1 1 )
)
)
)

miauu · 2024-08-26





(
	creaseVal = 0.5
	poGetEDataValue = polyop.getEDataValue
	obj = modPanel.getCurrentObject()
	selO = selection[1]
	
	case classOf obj of
	(
		Editable_Poly:
		(
			numEdges = polyop.getNumEdges obj
			edgToSelBA = #{}
			for i = 1 to numEdges where (poGetEDataValue obj 2 i) >= creaseVal do edgToSelBA += #{i}	
			subobjectlevel = 2
			polyop.setEdgeSelection obj edgToSelBA
		)
		Edit_Poly:
		(
			numEdges = obj.getNumEdges()
			edgToSelBA = #{}
			for i = 1 to numEdges where (poGetEDataValue selO 2 i) >= creaseVal do edgToSelBA += #{i}	
			subobjectlevel = 2
			obj.SetSelection #Edge #{}
			obj.Select #Edge edgToSelBA
		)		
	)
	redrawViews()
)

Grateful for that! :):):)

fzxj520 · 2024-08-26

:):):)