(Solved) GetPointDynamicDrawFunc wrong drawing if rotating

Hello i m new to Rhino scripting and have implement a DynamicDrawFunc to show a preview of my objects.

I am scaling some objects based of a start and a endpoint and if the endpoint is over the startpoint i rotate the objects about 180 degree.

Here my python code:

def GetPointDynamicDrawFunc(sender, args):
                global _afassung
                _afassung = TransformBrep(_afassung, _aDurchmesser ,_startpoint, args.CurrentPoint)
                brilliant = _afassung[0]
                afassung = _afassung[1]
                body = afassung[0]
                krappen = afassung[1]
                krappen_oben = afassung[2]
                alles = []

                vector_direction = Rhino.Geometry.Vector3d(0, 1, 0)
                for i in krappen:
                for i in krappen_oben:
                for i in brilliant:
                for i in alles:
                    i.Rotate(_rotation * math.pi / 180, vector_direction, _startpoint)
                    args.Display.DrawBrepWires(i, Color.Yellow)

but only own view get rotated but all views get updated scales

some idee whats going wrong?

Hi Felix,

In order for us to be more helpful, you might want upload your entire working script. You can upload files in the Discourse editor by picking the up-arrow (upload) icon.

Also here is a python script that implements dynamic transformation drawing that might help you:


– Dale

Thanks for your reply.

I allready found this example and the basic transformation and DynamicDraw is working. Scaling is working, only the rotating if z is positiv isnt working correct.

i will add my working script.NeuFassungKrappen_cmd.py.back.py (18.8 KB)

The commandline options are german but the default settings are fine for testing.

Hi Felix,

Transformations are best applied once. To do this, you will need to multiple transformations together.

For example:

xform_rotation = Rhino.Geometry.Transform.PlaneToPlane(plane0, plane1)
xform_scale = Rhino.Geometry.Transform.Scale(plane1, length, length, length)
xform_final = xform_scale * xform_rotation

saddly this was not the problem but good to know.

I have found the solution in my def TransformBrep. I changed this:

def TransformBrep(fassung, durchmesser, startpoint, endpoint):
    brilliant = fassung[0]
    afassung = fassung[1]
    body = afassung[0]
    krappen = afassung[1]
    krappen_oben = afassung[2]

to this:

def TransformBrep(fassung, durchmesser, startpoint, endpoint):
    brilliant = deepcopy(fassung[0])
    afassung = fassung[1]
    body = afassung[0].DuplicateBrep()
    krappen = deepcopy(afassung[1])
    krappen_oben = deepcopy(afassung[2])

there muss be some reference been saved and not updated correctly if i not copy all breps bevor transform them.

Thankyou for helping