no worries. It would be easy to make into an operation if anyone was so inclined. I think.


I posted a script for destroying an object, but it was lost when the forum was changed, I think. Anyway I’ve rewritten to work on a selection of faces, and I think I’ve seen it called jitter in other applications – it moves pointsi in an object a little randomly to make them look imperfect.

So here’s the new script. Still don’t know how to post code so if you want it check word wraps etc. the pikky is of a merino before and after the fleece is jittered, in this case by a max of 0.005 of the object size

Language = VBScript

‘ Purpose: move all point in a face selection by a random amount
‘ Script by George Jenner, January 2004
Option Explicit ‘require variable declarations
Sub Main (3DCApp)

Dim Scene
Dim ActiveObjectCount
Dim ActiveFaceCount
Dim Object
Dim PointCount
Dim ii ‘for looping
Dim jj
Dim BoxMinX ‘The Object’s Bounding Box
Dim BoxMinY ‘The Object’s Bounding Box
Dim BoxMinZ ‘The Object’s Bounding Box
Dim BoxMaxX ‘The Object’s Bounding Box
Dim BoxMaxY ‘The Object’s Bounding Box
Dim BoxMaxZ ‘The Object’s Bounding Box
Dim XSize
Dim YSize
Dim ZSize
Dim XDelta
Dim YDelta
Dim ZDelta
Dim PX
Dim PY
Dim PZ
Dim Points() ‘ and array to see if a point has already been moved
Dim Face ‘Face we are working on
Dim ObjectPoint ‘number of point in the object
Dim FacePoints ‘numbe of points in a face
‘get the scene
Set Scene = 3DCApp.GetActiveScene
‘get the active object count
ActiveObjectCount = Scene.GetActiveObjectCount
‘ msgBox(‘Points ‘ and ActiveFaceCount)
‘only proceed if there is an active object
If ActiveFaceCount andlt;1 Then
MsgBox ‘Please select at least one face.’
‘get the active object (right now there can only be one)
Set Object = Scene.GetActiveObject(0)
‘get the object’s dimensions
Object.GetBoundingBox BoxMinX, BoxMinY, BoxMinZ, BoxMaxX, BoxMaxY, BoxMaxZ
XSize = BoxMaxX-BoxMinX
YSize = BoxMaxY-BoxMinY
ZSize = BoxMaxZ-BoxMinZ
XDelta = InputBox(‘Max to move X? I want a proportion of it’s size: ‘and XSize,,’.01′)
YDelta = InputBox(‘Max to move Y? I want a proportion of it’s size: ‘and YSize,,’.01′)
ZDelta = InputBox(‘Max to move Z? I want a proportion of it’s size: ‘and ZSize,,’.01′)
‘so Maximum Perturbations are +/-
PointCount = Object.GetPointCount
Redim Points (PointCount) ‘this will be set to 1 if the point is moved
for ii=0 to PointCount-1
for ii=0 to ActiveFaceCount-1
set Face=Scene.GetActiveFace(ii)
For jj= 0 to FacePoints-1
ObjectPoint=Face.GetPoint (jj)
if Points(ObjectPoint)=0 then ‘then it hasn’t yet been moved
Object.GetPoint ObjectPoint, PX,PY,PZ
Object.SetPoint ObjectPoint, PX+XDelta-(2*Rnd*XDelta),PY+YDelta-(2*Rnd*YDelta),PZ+ZDelta-(2*Rnd*ZDelta)
end if
end if
‘finally write a Script operation layer to save the change
Object.GenerateNormals 3.1415926/3

End Sub

end script

i like this – it seems to add more detail to an object with little or no work

Yep, ecxatly what I have been looking for! <!– s:) –><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!– s:) –>

‘Eat me! See if I care.’

Can also be used to make a decent terrain effect too.. <!– s:) –><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!– s:) –>

This is great, thanks Geo_jenner! <!– s:) –><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!– s:) –>

You must be logged in to reply in this thread.