December 9, 2001
at 12:00 pm /
#11354
I’ve been experimenting with modifiying the andquot;shift active objectandquot; script into a andquot;shift active FACEandquot; script. The script runs but I get rather unusual results, perhaps as a result of a lack of understanding on my part…
For example:
Does Set Face = andquot;Scene.GetActiveFace(0)andquot; return the selected face if only one face is selected?
The fragment of interest is:
‘ ***********BEGIN*********************
Dim Object, Face, ShiftX, ShiftY, ShiftZ
Dim PointCount
Dim PointIndex, CurrentIndex
Dim PointX
Dim PointY
Dim PointZ
Dim ActiveFaceCount
‘ fixed shifts for testing
ShiftX = 0
ShiftY = 1
ShiftZ = 0
‘assume 1 active object
Set Object = Scene.GetActiveObject(0)
‘ and one face ??????
Set Face = Scene.GetActiveFace(0)
‘get the number of points in the face
PointCount = Face.GetPointCount
‘Run through the points shifting them
For PointIndex = 0 to PointCount – 1
‘get the point index in the object
CurrentIndex = Face.GetPoint(PointIndex)
‘ get the coord of the point
Object.GetPoint CurrentIndex, PointX, PointY, PointZ
‘shift the point
PointX = PointX + ShiftX
PointY = PointY + ShiftY
PointZ = PointZ + ShiftZ
‘set the point
Object.SetPoint PointIndex, PointX, PointY, PointZ
Next
‘ ************* END *******************
When the above is run against a face of a cube the shift appears to do the expected only if the face is the -Z most face (the face shifts up by 1). Running against a different face yields a very distorted cube.
Thanks in advance!
Deanville