Re: Select Edges by Angle
| Date : Tue, 31 Oct 2006 17:54:07 +0100 |
| To : XSI(at)Softimage.COM |
| From : "Reinhard Claus" <rclaus(at)gmail.com> |
| Subject : Re: Select Edges by Angle |
On 10/31/06, Reinhard Claus <rclaus(at)gmail.com
> wrote:
Hey there, found this script by Chris Peltz on my old pc:
seems if you replace "70" in the first line with the current discontinuity angle ("Sel(0).gemapprox.angle_discont" or something like this), you'll get there
Reinhard
' ------------------------------------------------------------
' Copyright (c) 2003, by Christopher Peltz
' SelectHardEdges -- v2
'
'
' This script requires that one and only one polymesh
' object be selected. It will then select all the "hard"
' edges of the polymesh object... that is edges where the
' adjoining faces have an angle of greater than 70 degrees
' (one day I need to learn how to use a dialog box to input
' an appropriate angle)
' -------------------------------------------------------------
SelectHardEdges_Main (70)
sub SelectHardEdges_Main (hardEdgeLimit)
dim oSelection, oGeom, oEdges, oEdge, oPolys
dim inError
dim o2d
inError = false
if (hardEdgeLimit = 0) then
hardEdgeLimit = 70
end if
set norm1 = CreateObject("Sumatra\Scripting\Math\SIVector3")
set norm2 = CreateObject("Sumatra\Scripting\Math\SIVector3")
set EdgeCentre = CreateObject("Sumatra\Scripting\Math\SIVector3")
set C1 = CreateObject("Sumatra\Scripting\Math\SIVector3")
set C2 = CreateObject("Sumatra\Scripting\Math\SIVector3")
ActivateObjectSelTool
set oSelection = Application.Selection
if oSelection.Count <> 1 then
LogMessage "A single polymesh object needs to be selected", siError
inError = true
elseif oSelection(0).Type <> "polymsh" then
LogMessage "A polymesh object needs to be selected", siError
inError = true
end if
' if no error in selection then lets do the deal...
if (inError = false) then
selObjName = oSelection(0).Name
set o2d = oSelection(0).obj.Geometry2D
set oGeom = oSelection(0).ActivePrimitive.Geometry
set oEdges = oGeom.Edges
ActivateEdgeSelTool
for each oEdge in oEdges
set oPolys = oEdge.NeighborPolygons
if (oPolys.Count = 2) then
angle = GetFacetAngle(oPolys(0), oPolys(1))
edgeName = selObjName & "." & oEdge.FullName & "[" & oEdge.Index & "]"
LogMessage edgeName & "angle = " & angle
if (angle >= hardEdgeLimit) then
AddToSelection edgeName
else
RemoveFromSelection edgeName
end if
end if
next
end if
end sub
function GetFacetAngle (facetA, facetB)
set normalA = GetFacetNormal(facetA)
set normalB = GetFacetNormal(facetB)
angle = normalA.Angle(normalB)
' convert from radiens to degrees...
angle = angle * 57.29577951
GetFacetAngle = angle
end function
function GetFacetNormal (facet)
set normal = CreateObject("Sumatra\Scripting\Math\SIVector3")
normal.SetNull
for each oPolygonNode in facet.Nodes
normal.AddInPlace(oPolygonNode.Normal)
next
normal.NormalizeInPlace
set GetFacetNormal = normal
end function
On 10/31/06, Adam Seeley < adam.seeley(at)clearpost.co.uk> wrote:Thanks,I think mentioning "Hard Edges" is a false lead.What I want is a script to Select Edges dependent on the how sharp they are (or rather based on the angle between the adjacent faces).Adam.-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM]On Behalf Of Stephen Blair
Sent: 31 October 2006 15:50
To: XSI(at)Softimage.COMSubject: RE: Select Edges by Angle______________________________________________________________________Hi AdamYou should be able to find it in XSI Netmodel tab > MCP_UI / Selection / Select Hard Edges of Polymesh
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf Of Adam Seeley
Sent: Tue 31 October 2006 10:11 AM
To: XSI(at)Softimage.COM
Subject: Select Edges by AngleHi,has anyone seen the Select Hard Edges by Angle script that was on XSIBase?(or any other Select edges any Angle script)It'd be a very handy script to have today.Thanks,Adam.
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
- References:
- RE: Select Edges by Angle
- From: "Adam Seeley" <adam.seeley(at)clearpost.co.uk>
- Re: Select Edges by Angle
- From: "Reinhard Claus" <rclaus(at)gmail.com>
- RE: Select Edges by Angle
| DATE: | << | >> | THREAD: | << | >> | INDEX: | Main | Thread |
|---|
- Previous by Date: RE: Realflow XSI plugin?
- Next by Date: RE: Realflow XSI plugin?
- Previous by Thread: RE: Realflow XSI plugin?
- Next by Thread: RE: Realflow XSI plugin?
- Index(es):
| Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available. |