Problemas con data-shapes y python script

Hola, hice un script para poner el armado de una columna o castillo, sin data-shapes funciona correctamente, pero al agregar todos los elementos de data-shapes me da un error en un nodo de python scripts para hacer offset de unos puntos. alguien sabe que pudiera ser?


[Translated by moderation]
Hello, I wrote a script to assemble a column. Without data shapes, it works correctly, but when I add all the data shape elements, I get an error in a Python script node for offsetting some points. Does anyone know what could be causing this?

preferiblemente en inglés

1 Like
Hi, I created a script to set up a column or castle. It works correctly without data shapes, but when I add all the data shapes, I get an error in a Python script node to offset some points. Does anyone know what this could be?
Hi, I created a script to set up a column or castle. It works correctly without data shapes, but when I add all the data shapes, I get an error in a Python script node to offset some points. Does anyone know what this could be?

What is the error message? Could you try using OffsetMany() ?

return c.OffsetMany(distance, vector)

hi @javierdvc

here is an example

import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

def toList(x):
    if isinstance(x, (list, dict)):
        return x
    else : return [x]

curves = toList(IN[0])
distances = toList(IN[1])
vectors = toList(IN[2])

OUT = [c.OffsetMany(d, v) for c, d, v in zip(curves, distances, vectors)]
1 Like

The Datashapes inclusion is causing the issue as it adds an extra layer for lists in all cases.

As your code is just calling Curve.Offset and nothing else you should stop writing it in Python and use the node in Dynamo. This will give many benefits:

  1. Faster as you don’t have to bounce from C# to Python to C# - everything happens in C# with nodes.
  2. Less custom dependencies to manage
  3. More maintainable as the one change to Curve.OffsetMany will likely cover you for the next 5 years but the Python engines will assuredly not be consistent over that same timespan.
  4. Troubleshooting will be easier as you won’t have to manage the content over time.
  5. You will receive notices around deprecated nodes such as Curve.Offset which has been removed from the official library for about 11 Dynamo releases now (almost 4 years).
1 Like