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 = []
alles.append(body)
vector_direction = Rhino.Geometry.Vector3d(0, 1, 0)
for i in krappen:
alles.append(i)
for i in krappen_oben:
alles.append(i)
for i in brilliant:
alles.append(i)
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
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:
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 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:
```python
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