Quantcast
Channel: Scripting - McNeel Forum
Viewing all 5854 articles
Browse latest View live

Filet corner script

$
0
0

Hello!!!
I pass a lot of time to make filet on rhino 3d cad, and every time on corners I have to cut the 3 or 4 filets end and make a 2rails surf or other on the corner … I made a script to cut the end, and I’ll search for it create the surface automatically at the end…

The question is: is there someone how already made a script for this… If yes thank you… If no, I’ll search and post it ASAP!!:grin:

1 post - 1 participant

Read full topic


Python IDE/workflow for newbie

$
0
0

I am struggling to get set up. I have run into limitations scripting in a GH component, and in the Python script window in Rhino. I have downloaded PyCharm and got it running IronPython, but the instructions beyond that… those breadcrumbs have been scattered by time. I also tried downloading a few other IDEs, but they turned out to be dead ends as well.

Does anyone have a workflow that allows them to edit and debug python while being able to see what it means in a Rhino window? Or anything even close to that?

I cannot tell from what’s available online if RhinoInside for python is intended to help with this or not. Does anyone know?

Thanks in advance-

1 post - 1 participant

Read full topic

AddSrfPtGrid doesn't work

$
0
0

(topic withdrawn by author, will be automatically deleted in 24 hours unless flagged)

1 post - 1 participant

Read full topic

Expected Ienumerable[curve], got list

$
0
0

hello every body!!!
i search to create a network surface with:
Rhino.Geometry.NurbsSurface.CreateNetworkSurface(edges,2,0,0,0,0)

but it return an error:
expected IEnumerable[Curve], got list
how can i transform a list to an IEnumerable,

i searched but what is the difference between an IEnumerable and list?

Only!

1 post - 1 participant

Read full topic

Question about using DrRacket as a front end and Rhino as a backend with the book "Programming for Architects"

$
0
0

Hello there,
To Whom It May Concern:
I am working along with a book titled “Programming for Architects”, it uses

DrRacket as a frontend and Rhino or AutoCAD as a backend, right now I am on section 3.3 called

“Bi-Dimensional Geometric Modelling” so they ask the user to input this two lines in DrRacket’s interface:

#lang racket
(require (planet aml/rosetta))
(backend rhino)

Now, this doesn’t work, but I manage to get at least to the REPL using the following lines:

#lang racket

(require rosetta)
(backend rhino)

Like I said this seems to work to get to the REPL, now when I try the following commands:

(circle (pol 0 0) 4)
(circle (pol 4 (/ pi 4)) 2)
(circle (pol 6 (/ pi 4)) 1)

No matter which one I type, the error message is always the same:

Couldn’t find Rhinoceros

I know, I am very close but I am missing something, what do I need to do in order to write commands in DrRacket and

get Rhino to follow/obey those commands?

Any and all help will be really appreciated.

Thanks.

Alfonso Urroz-Aguirre

6 posts - 4 participants

Read full topic

Batch Export PDF

$
0
0

Hello Everybody

I am trying to create a script to batch export drawings as PDF files, and I’ve hit a wall. Any suggestions would be really helpful.

My goal is to automate exporting of 100+ files. I’ve looked at posts here (and a few other posts all day), but found only solutions with Layouts, using the GetPageViews() method.

page = sc.doc.Views.GetPageViews()

Here are my questions:

  1. Is there a way to automatically arrange the Layout’s Detail Window (is that how I should call it?) to cover my modelspace, similar to Set Window feature in a Print Command?

  2. I’ve been trying to use the _-Print command to set up all necessary settings. But, I end up with a pop-up window, that requires me to Manually enter the FileName as well as the location. Although, I see the prompt for entering a filename in the console, I can’t get it to work. Is it possible to override the pop-up box?

File1: 2021.01.11 - batchExportPDF.3dm (139.0 KB)
File2: 2021.01.11 - batchExportPDF.gh (3.8 KB)

def exportPDF(fileName):

    # A4 Portrait
    a4x = "210"
    a4y = "297"

    separator = "\\"
    if platform.system() == "Darwin": separator = "/"

    # Get current file directory
    activeDocPath = str(os.path.dirname(os.path.realpath(Rhino.RhinoDoc.ActiveDoc.Path)))

    # Rhino _Macro
    Rhino.RhinoApp.RunScript("_-Print Setup Destination PageSize _Enter" + a4x + " " + a4y + " Enter View ViewportArea Window " + a4x + "," + a4y + " 0,0 _Enter _Enter Go _Enter" , True)

    # Trying to get this work
    # Rhino.RhinoApp.RunScript("_-Print Setup Destination PageSize _Enter" + a4x + " " + a4y + " Enter View ViewportArea Window " + a4x + "," + a4y + " 0,0 _Enter _Enter Go _Enter" + activeDocPath + separator +  fileName + ".pdf", True)

    return

~ ~ ~ ~ ~ ~ ~ ~
Kaushik LS
Chennai, IN

2 posts - 2 participants

Read full topic

Script is crashing, locking up rhino

$
0
0

i’ve got a script here that @pascal provided me awhile ago. it had been working fine but it’s hanging and locking up rhino.

any ideas? thank you

FinTools.py (13.6 KB)

2 posts - 2 participants

Read full topic

Split an object with a line

$
0
0

Hi!
I need to split an object using a line and delete the left side. How can I do it automatically using the python script?Example.3dm (65.4 KB)

4 posts - 3 participants

Read full topic


Untrim Hole in Grasshopper Python

$
0
0

Hello Everybody,

is there a way to create script in Python Grasshopper which would work same as ‘Untrim Hole’ command in Rhino? I have some trimmed surfaces with holes in it, if I use Untrim in grasshopper, it would untrim also surface edges.

Thank you for your advise!

Cheers.

2 posts - 2 participants

Read full topic

Python Script

$
0
0

Hi!
I am a newbie and therefore still relatively inexperienced in terms of scripting and the possibilities.
I would like to pull up walls in 3D and connect them to a box, then copy it several times in all directions. So to say a big box from several small ones. Then I would have to be able to delete certain walls automatically, so that a kind of structure is created.

Kinda like this

Is this possible? Can anyone help me?

15 posts - 3 participants

Read full topic

Rhino 7 - GetColor() missing transparency

$
0
0

Hi there! I’ve been using this lovely little script to quickly change the colors of objects:
import rhinoscriptsyntax as rs

    def QuickColour():
        objects = rs.GetObjects("Pick objects for colour change", 0, None, True)
        if objects is None: return
        rs.EnableRedraw(False)
        colour = rs.GetColor(rs.ObjectColor(objects[0]))
        if colour is None:
            rs.UnselectAllObjects()
            rs.EnableRedraw(True)
            return
        else:
            for object in objects:
                rs.ObjectColor(object, colour)
                rs.ObjectPrintColorSource(object, 2) 
        rs.UnselectAllObjects()
        rs.EnableRedraw(True)

    if __name__ == "__main__":     
        QuickColour()`Preformatted text`

The issue is that now the HSL sliders are missing the transparency option:
image

Compared to editing color the “normal” way:
image

Is there any way around this issue?

3 posts - 2 participants

Read full topic

CreatePreviewImage rhinoscript command not working in Rhino 7

$
0
0

Hi,

I’m trying to create a preview image using Rhinoscript using this line:
Rhino.CreatePreviewImage("C:\Users\jordi\test.jpg")

It is working in Rhino 5 and 6 but it is not in Rhino 7 (tested on 7.2.21012.11001, 12/01/2021). I get a black image.

2 posts - 2 participants

Read full topic

Open Grasshopper/Rhino files at the same time?

$
0
0

Hello
Is there a way to open Grasshopper and Rhino files of the same project together?
And how to open Rhino file with ghpython?

1 post - 1 participant

Read full topic

2 Macros please

$
0
0

Could someone please tell me what the macro would be for:
Arc - start end direction
and
Arc - center start angle

I use these a lot and would like to attach them to an alias.

Thank you.

3 posts - 2 participants

Read full topic

Real world, practical use cases of Python for architectural design for beginners

$
0
0

Hello everyone,
what do you use python for in your daily workflows? I am looking for examples to give to my students at the TU Darmstadt.

I am teaching a course on the basics of computational design that aims to cover the core concepts behind this broad field such as combinatorial design, generative design and computational analysis. Here is the intro video to the course (https://www.youtube.com/watch?v=sCptKvK-9Hg).

The upcoming tutorial is about python scripting.

I plan to give a basic intro to the language but also want to illustrate the tutorial with a simple use case. I would like to avoid the most popular agents simulation example (flocking) as in my experience it had little practical relevance.

I have two questions to the community here:

  1. What do you use python in for?
  2. what would be for you the core python example for a complete beginner that is still linked to the design practice and not too computer-sciency :slight_smile:

My idea is to point my students to this very post so I hope for an interesting discussion and a diverse set of example use cases.

2 posts - 2 participants

Read full topic


Rhino to android apk

$
0
0

Is there possible to compile a 3d object in rhino into an android app? in order to skip importing it in unity.
food 4 thought

1 post - 1 participant

Read full topic

Cut my on Ribs(Waffles)

$
0
0

Olá a todos! preciso de ajuda para criar uma alteração em um script… uso o script Cut my on ribs para fazer estruturas waffles, abaixo mostrarei como fica atualmente ao rodar o script:

mas preciso que tenhga um circulo conforme imagem abaixo:

alguém pode me ajudar?

1 post - 1 participant

Read full topic

Intersection Mesh-Plane Rhinoscript

$
0
0

Hi,

I try to write the rhinoscript for the intersection of the mesh with the predefined plane resulting in the polyline/curve. I found this method “Mesh.CreateContourCurves Method (Mesh, Plane)” used for. But not in the list of the rhinoscript methods. The command “section” also works very well.
But I do not know how can it be applied in the rhinoscript. Can you help me pls ? Thanks.

3 posts - 3 participants

Read full topic

Bake objects with Ghpython?

A script for joining by Material-

$
0
0

Hi I have been searching like crazy but cannot figure it out by myself…
How can I write a script,
that selects one layer after another,
and then select the geometry on that layer by Material,
and then joins the surfaces by their Material.
I tired many things using rhinoscript, but didnt get to far…
It sound simple at first, but is quite tricky-
Any suggestions? Please :slight_smile:

1 post - 1 participant

Read full topic

Viewing all 5854 articles
Browse latest View live


Latest Images