Re: select only facing polygons

Date : Mon, 21 Aug 2006 16:30:13 +0100
To : <XSI(at)Softimage.COM>
From : "adrian" <adrian.wyer(at)fluid-pictures.com>
Subject : Re: select only facing polygons
hope, or adams?

Adrian Wyer
Fluid Pictures
33 Glasshouse Street
London
W1B 5DG
----- Original Message -----
Sent: Monday, August 21, 2006 4:27 PM
Subject: Re: select only facing polygons

Thats what I was looking for Adrian...
 
Thanks a lot !!!
 
it takes a bloody age to process but works like a charm !!
 
ta
 
Alex
 
kick Danny for me, if he is still working with you !!!

 
On 8/21/06, adrian <adrian.wyer(at)fluid-pictures.com> wrote:
there is a script called poly plane select
 
not sure if it works in 5.11
 
'------------------------------------------------------------------------------
' PolyPlaneSelect.vbs
' DESC: Select all polygon facing one direction
' AUTHOR: Martin-Karl Lefrancois
'   November, 2000
'------------------------------------------------------------------------------
Option Explicit
 
Dim XSIDial, Plane, Combo
Set XSIDial = createobject("XSIDial.XSIDialog")
 
Combo = Array("Right","Top", "Front","Left","Bottom","Back")
Plane = XSIDial.Combo( "Select the current plane", Combo)
 
if Plane => 0 then
Dim Tolerance
Tolerance = InputBox("Tolerance", ,0.3)
PolyPlaneSelect Plane, Tolerance
end if
 
Sub PolyPlaneSelect( inPlane, inTolerance )
 Dim lGeo, lSel, lSelPoly, bFirst
 Dim myNor, i, aNormal, lOri, lItem, lObj
 
 Logmessage "Try to select polygons facing plane: " & inPlane
 
 bFirst = true
 
 'Get the Selected object
 Set lSel = Selection
 
 'We are not sure the  
    For Each lItem In lSel
        Set lObj = lItem
        Exit For
    Next
   
    'Trick to get the X3DObject
    If TypeName(lObj) = "CollectionItem" Then
        Set lObj  = ActiveProject.ActiveScene.Root.FindChildren(lObj.name)
        Set lSel = lObj(0)
       
    Else
     Set lSel = lObj
    End If
 
 If TypeName(lSel) <> "X3DObject" Then
  MsgBox "Wrong type of object! " & TypeName(lSel)
  Exit Sub
 End If
 
 'Get the Geometry, must be a polygon mesh
 Set lGeo = lSel.ActivePrimitive.Geometry
 If lGeo.name <> "polymsh" Then
  MsgBox "Wrong type of primitive! " & lGeo.name
  Exit Sub
 End If
  
 'The Normal of the polygon
 Set myNor = CreateObject("Sumatra\Scripting\Math\SIVector3")
 
LogMessage "Number of faces: " & lGeo.Facets.Count
 'Get the polygons
 For i=0 to lGeo.Facets.Count -1
  'Get polygon normal
  aNormal = lGeo.Facets.NormalArray
  myNor.Set aNormal(0,i),aNormal(1,i),aNormal(2,i)
  'LogMessage "Normal: " & myNor.x & " | " & myNor.y & " | " & myNor.z  
 
  ' 0=x 1=y 2=z 3=-x, 4=-y 5=-z
  If FGetNormOri(myNor, inPlane, inTolerance) Then
   'LogMessage "Found"
   If bFirst = true Then
    lSelPoly = i
    bFirst = false
   Else
    lSelPoly = lSelPoly & "," & i
   End If
   
  End If
  Next
 
 'Do the Selection
 If lSelPoly <> "" Then
  SelectGeometryComponents lSel & ".poly[" & lSelPoly & "]"  
 End If
 
End Sub
 
'------------------------------------------------------------------------------
' DESCRIPTION: Return the orientation of the normal 0=x 1=y .. 3=-x, 4=-y
'------------------------------------------------------------------------------
Function FGetNormOri(i_Norm, i_Plane, i_Tol)
 dim lVect, lDot
 Set lVect = CreateObject("Sumatra\Scripting\Math\SIVector3")
 
 Select Case i_Plane
 case 0
  lVect.set 1,0,0
 case 1
   lVect.set 0,1,0
 case 2
  lVect.set 0,0,1
 case 3
  lVect.set -1,0,0
 case 4
  lVect.set 0,-1,0
 case 5
  lVect.set 0,0,-1
 end Select
  
 lDot = i_Norm.dot(lVect)
 
 if lDot-(1-i_Tol) > 0 then
  FGetNormOri = 1
 else
  FGetNormOri = 0
 end if
 
End Function
 

 
 

Adrian Wyer
Fluid Pictures
33 Glasshouse Street
London
W1B 5DG
----- Original Message -----
Sent: Monday, August 21, 2006 12:54 PM
Subject: Re: select only facing polygons

 
You could slap on a texture projection, open the Texture Editor and select whichever side, then use the script that converts sample points to tagged and get polys from that.
 
Morten Bartholdy
3D & VFX Artist
 
 
----- Original Message -----
Sent: Monday, August 21, 2006 1:17 PM
Subject: select only facing polygons

 
I have built a very basic city scape out of cubes.. I want to go into the right hand view. hit the Y key.. and select ONLY the polygons that are facing me. (X)
 
So leaving all the roof tops, the floor and the front of the buildings.. just the right hand side ???
 
Does anyone know if there is a script floating about to do this, Or isn't this possible ? do I have to go in and do them all by hand ??
 
thanks
--
kind regards

Alex Dinnin



--
kind regards

Alex Dinnin

Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.