The Global ARCHICAD Community

Stay informed. Get help. Share your knowledge.

Topics related to the Grasshopper-ARCHICAD Connection and the various tasks that can be achieved with it.

Moderators: Karl Ottenstein, LaszloNagy, ejrolon, Barry Kelly, gkmethy

#285384
Hi!
I'm looking for a way to activate/simulate the "Set one 2D curve in ARCHICAD" through Python or C#.
Anyone familiar with the Grasshopper.Kernel SDK https://developer.rhino3d.com/wip/api/g ... 94df75.htm and know how to prompt this command?


Explaination:
1. User clicks the toogle button and send a "True" boolean to Python/C# script
2. Python/C# component triggers the "Set one 2D curve in ARCHICAD" for selected component
3. User is directed to ARCHICAD to select one curve (same as happens when you right click on component and selects "Set one 2D curve in ARCHICAD"

I've been reding about controlling grasshopper components through code here:
http://james-ramsden.com/grasshopper-wi ... component/
http://james-ramsden.com/read-and-edit- ... omponents/

Anyone who can help me out with this?
Thanks!
guid.JPG
#285599
TOPIC IS SOLVED OVER AT DISCOURSE

Here's the python code:
Code: Select all
#Import libraries
import Grasshopper
import System

#Declare variables for Component Name & Menu Event
compName = "2DC"
menuEvent = "Set one 2D curve in ARCHICAD"

#Loop over objects in active document
for obj in Grasshopper.Instances.ActiveCanvas.Document.Objects:
    if obj.NickName == compName:
        menu = System.Windows.Forms.ToolStripDropDown()
        obj.AppendMenuItems(menu)

        for item in menu.Items:
            if item.Text == menuEvent:
                item.PerformClick()
#300513
This is exactly what I'm looking for. I'm trying to set up a Human Interface for a GH-Archihcad connection script. And I need a *Set Curve in Archicad * button. (Also a set multiple windows button) Thing is I'm no good with Python. Any chance you could share your script?