Why the object doesn't appear in the Rhino viewports?

The shape is relative to the GHpython code but it doesn’t appear in the viewports of Rhino

You’re more likely to get help if you post a grasshopper (.gh) file.

-Kevin

It was only the code I copied from “developer.Rhino 3d.come” and pasted into GhPython script, but nothing appeared in the Rhino viewports. I couldn’t find the code between many nested lists of the website again (I forgot the title).

Remember, use rhinoscriptsyntax for Rhino, and RhinoCommon - the API - for Grasshopper!

import Rhino.Geometry as rg
import math

a = []   # declare output a as an empty list

t = -500.0  # set variable t to a start value
while t < 500.0:  # runs as long a t is smaller than an end value
    pt = rg.Point3d(t * math.sin(5*t), t * math.cos(5*t), t)  # create a three-dimensional point
    a.append(pt)  # add the point to list a
    t += 1.25  # increment t by a step value

You could at least post the code next time you encounter an issue.

1 Like

Thank you very much for the enlightening

But what the code I posted is?

Why did the website pose the code as a tutorial and import “rs” instead of “rg”? And why that code does not react, neither to out nor a?

Moreover, if I want to draw a curve (like Helix) through the points, what should I do, and what script should be added to the code that you sent?

It will be a new lesson for me :slight_smile:

You posted a screenshot. If someone wants to run your code they will need to type it in. Also, your screenshots do not show what the inputs and outputs to the GhPython Script component are.

Best approach is to post a grasshopper file.

-Kevin

1 Like

You are right, senior

Hereafter, if I had a problem, I will send the .gh file itself.

I don’t know. I can just tell you what - in my experience - would be a way to get this going.
Is this even from a tutorial about GHPython or RhinoPython?
Not every tutorial and piece of documentation is also up to date. That’s just how it is.

By the way, the out component output shows component output and is not meant to pass data through! When you for instance print something, it gets output via out, or if an exception (error) occurs somewhere. You can connect a panel to it.

What kind of curve, a polyline or interpolated N.u.r.b.s. curve?
As an exercise, I’d say try it yourself. Refer to the documentation, it’s searchable, and many pages have sample code. If you get stuck, post how far you’ve got and someone will probably help you.

1 Like

What kind of curve, a polyline or interpolated N.u.r.b.s. curve?

My purpose was an interpolated curve.

However, I don’t take your time anymore and will try to find the manner of drawing the curve in the reference.

Many thanks for your clear explanations :slight_smile: