Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all 8573 articles
Browse latest View live

GridView: getting horizontal scroll position and column (re)order

$
0
0

@sarg wrote:

Two GridView questions:

  1. Is it possible to get the horizontal scroll position? Or the x,y position of a specific column or cell? Context: I have a drawable beneath a GridView that I’m using to show totals. I’d like it to pan left-to-right in sync with the table.
    image
  2. Relatedly, how does one look up the order of re-ordered columns? (GridView.Columns appears to access the orginal order.)

Thanks,

Jon

Posts: 1

Participants: 1

Read full topic


Installer for Grasshopper plugin

$
0
0

@Petras_Vestartas wrote:

Hi,

I would like to ask how to create simplest installer for installing custom grasshopper addon?

I want to avoid manual copy paste files to grasshopper components folder and unblocking. So that the user would be required to download one file and would press a few times next and finish.

Thanks

Posts: 2

Participants: 2

Read full topic

Test validity of input for number does not differentiate between Points and numbers!

$
0
0

@su.lwpac wrote:

I created a test for validity of number, but when I connect a Point to it. It does not give the false output for it. Any idea why?
Here is the Code:

private void RunScript(double x, ref object A)
  {

    if (RhinoMath.IsValidDouble(x))
    {
      Print("All Good");
    }
    else
    {
      Print("Please Provide number");
    }

Here is the output on Grasshopper canvas:
image

Posts: 2

Participants: 2

Read full topic

Exporting multiple materials, each to an rmtl file

$
0
0

@11159 wrote:

Hello, everyone.

I use Rhino6 (Windows 10 Rhino6 SR24) and I want to export each of the multiple materials to an rmtl file.
Of course, I can export one by one, but I’d like to be able to export one at a time with a script or something.

In Rhino6, I could export to rmtl with the [-Materials] command, so I was able to export a named material with the following script.

===========================================================================
# -- coding: utf-8 --

import rhinoscriptsyntax as rs
rs.Command('! _-Materials _Options _SaveToFile "Glass" "C:\export\Glass_export.rmtl" _Enter _Enterend')

===========================================================================

But in this way, I have to specify the material’s name or ID, respectively.
How can I select the names or ID of existing materials?

import scriptcontext as sc
sc.doc.RenderMaterials		

??

Best regards,
Masaki

Posts: 4

Participants: 2

Read full topic

Loading Grasshoper component as .dll

$
0
0

@mikadeity wrote:

Dear all,

I tried googling a bit but I only find results from 2011.

Can I include my Grasshopper components in my Rhino plugin dll (I manage to load to Rhino as dll instead of rhp without problems) and then load it to grasshopper?

I want to have less components possible and also reference the plugin from Grasshopper and hare methods easily.

Hope to find a positive answer!

Posts: 2

Participants: 2

Read full topic

Display Conduit Geometry Goes Dotted when Control Points Turned On

$
0
0

@bradlcampbell wrote:

I have a RhinoCommon plugin in c# that draws some persistent curves. The plugin is built for both Rhino 5 and Rhino 6 (using shared projects in VS which is kind of interesting but unrelated). In Rhino 5 only, when I turn on the control points for any surface, the solid lines I have drawn (using a display conduit) turn dotted and are very hard to see. Rhino 6 does not do this.

Any thought on what might be causing this and how to fix it?

Thanks,
Brad

Posts: 1

Participants: 1

Read full topic

Adding text to instancedefinition (block)

$
0
0

@matti.pirinen wrote:

Hi @dale and others,

Is there someway I can add text objects to instancedefinition (block). It seems that the constructor only allows GeometryBase objects to be added. I can create block manually which includes text so I would think there should be some way…

-Matti

Posts: 3

Participants: 2

Read full topic

Index incorrect in rhincommon api help for ArcCurve


ETO differences Windows-Mac

$
0
0

@em.rudelle wrote:

After starting debugging a plugin under macOS, I realised how different can eto UI look like on different platform. After some work, there are still one-two problems that I cannot fix, no matter what.

First example Window sizes
All my windows are correctly sized on Windows, but look like having a supplementary margin on MacOS (see the two following pictures). This happends on all of my windows (they herit Eto.Forms.Form).


For these forms, I have already locked their size, bounds and set their padding to 0. Are there any margin (or other) parameters that I am missing anywhere ?

Second example text size
On some labels, and the one above is a good example, I have a big inconsistencies on the output size of a text. Although I have blocked many parameters (see code below) :

public Label welcomeMessage = new Label()
    {
        Text = "Welcome by [...] plugin for Rhino. \n" +
            "This plugin will help you interpret a geometry for further energy modelling. \n" +
            "As a first step, please import the csv database file exported by [...] for your project.",
        Font = new Eto.Drawing.Font(SystemFont.Default,10,FontDecoration.None),
        TextAlignment = TextAlignment.Left
    };

Congratulations
Finally I must say that ALL the rest of the plugin is working perfectly well on macOS, althought we developed 100% on Windows. Aside from this problem, it was very few efforts to have this working : congratulations and thanks to thoses behind this. :slight_smile:

Posts: 1

Participants: 1

Read full topic

Rhino6 OSX - Bug in eto control event handling "MouseUp"?

$
0
0

@marton.parlagh wrote:

I try to modify the behavior of the
Rhino.UI.Controls.NumericUpDownWithUnitParsing control, but I have some issues with it.

And I would like to have my own functions on some mouse event.

But it seems the MouseUp event is not triggered correctly. If I try to debug and add a breakpoint to MouseDown, after that the MouseEvent happens. But if I don’t block the program run at MouseDown with breakpoint MouseUp it is never called.

Another issue: the MouseMove event doesn’t show the mouse button status correctly.

I think it is not just the NumericUpDownWithUnitParsing control but more basic controls have this issue too.

Márton

Posts: 1

Participants: 1

Read full topic

(C++) Some issues when creating black skin with few items

$
0
0

@Pablo_Garcia-Amorena wrote:

Hi,

From all the resources I found around (specially @dale’s) I’ve made a skin (called Black Skin) that does the following:

  • Replace main view names with 3D View, Axial, Coronal, Sagittal
  • Set all views to rendered mode
  • Set black background color in rendered mode
  • Hide toolbars, control bars, menu bar and status bar
  • Set gumball on

Though, I’m not sure if I’m doing it properly, because when opening the skin it takes quite some time until Rhino is set up this way. I also see for some seconds the standard Rhino interface before things are hidden and background set to rendered black solid color.

I’m doing all the changes in a watcher derived from CRhinoIsIdle after an event of type OnInitRhino. As the steps heavily involve modifying the CRhinoDoc active document, I believe I can’t directly put them in a CRhinoEventWatcher OnInitRhino event, neither in OnLoadPlugIn(), can I?
On top of that, please tell me if some of these steps could be done more properly or efficiently with other Rhino sdk functions or in other places in code.

Here’s the full project

BlackSkin.zip (56.3 KB)
BlackSkinHandler.zip (33.6 KB)

and here’s the particularly relevant code doing the changes inside the idle watcher:

///////////// Watcher

class BlackSkinHandlerWatcher : public CRhinoEventWatcher
{
public:
   BlackSkinHandlerWatcher() = default;
   ~BlackSkinHandlerWatcher() = default;

   void OnInitRhino(CRhinoApp& app);
};

///////////// Idle Watcher

class BlackSkinHandlerIdleWatcher : public CRhinoIsIdle
{
public:
   BlackSkinHandlerIdleWatcher();
   ~BlackSkinHandlerIdleWatcher() = default;
   virtual void Notify(const class CRhinoIsIdle::CParameters& params);
};
///////////// Watcher

void BlackSkinHandlerWatcher::OnInitRhino(CRhinoApp& app) {
	BlackSkinHandlerPlugIn().m_initiatedRhino = true;
}

///////////// Idle Watcher

BlackSkinHandlerIdleWatcher::BlackSkinHandlerIdleWatcher()
	: CRhinoIsIdle(BlackSkinHandlerPlugIn().PlugInID())
{
}

void BlackSkinHandlerIdleWatcher::Notify(const CRhinoIsIdle::CParameters& params)
{
	ON_wString scheme = RhinoApp().RegistrySchemeName();
	if (BlackSkinHandlerPlugIn().m_initiatedRhino) // If Rhino has started
	{
		BlackSkinHandlerPlugIn().m_initiatedRhino = false;
		if (scheme.CompareNoCase(L"Scheme: BlackSkin") == 0) // If Black Skin scheme
		{
			CRhinoDoc* doc = RhinoApp().ActiveDoc();
			if (doc) 
			{
				// Replace view names with 3D View, Axial, Coronal, Sagittal
				ON_3dmView views[4];
				doc->FindView(L"Perspective", views[0]);
				doc->FindView(L"Top", views[1]);
				doc->FindView(L"Front", views[2]);
				doc->FindView(L"Right", views[3]);

				views[0].m_name = L"3D View";
				views[1].m_name = L"Axial";
				views[2].m_name = L"Coronal";
				views[3].m_name = L"Sagittal";

				doc->Properties().AddNamedView(views[0]);
				doc->Properties().AddNamedView(views[1]);
				doc->Properties().AddNamedView(views[2]);
				doc->Properties().AddNamedView(views[3]);

				doc->ReplaceModelViews(4, views);

				// Set all views to rendered mode
				ON_SimpleArray<CRhinoView*> standardViews;
				const int standardViewCount = doc->GetViewList(standardViews, true, false);
				for (int i = 0; i < standardViewCount; i++) 
				{
					CRhinoView* view = standardViews[i];
					if (nullptr != view) 
					{
						CRhinoViewport& vp = view->ActiveViewport();
						const CDisplayPipelineAttributes* pStdAttrs;
						pStdAttrs = CRhinoDisplayAttrsMgr::StdRenderedAttrs();
						vp.SetDisplayMode(pStdAttrs->Id());
					}
				}

				// Set black background color in rendered mode
				DisplayAttrsMgrListDesc* pAttrsDesc = CRhinoDisplayAttrsMgr::FindDisplayAttrsDesc(ON_StandardDisplayModeId::Rendered);
				if (pAttrsDesc) 
				{
					CDisplayPipelineAttributes* pAttrs = pAttrsDesc->m_pAttrs;
					if (pAttrs) 
					{
						pAttrs->m_eFillMode = EFrameBufferFillMode::FBFM_SOLID_COLOR;
						pAttrs->m_SolidColor = ON_Color::Black;
					}
				}

				// Hide toolbars, control bars, menu bar and status bar
				RhinoApp().HideToolBars();
				RhinoApp().HideControlBars();
				RhinoApp().HideWindowBars(0x00000002); //HWB_MENU_BAR
				RhinoApp().HideWindowBars(0x00000004); //HWB_STATUS_BAR

				doc->Regen();

				//Set gumball on
				RhinoApp().RunScript(doc->RuntimeSerialNumber(), L"_-Gumball _On _Enter", 0);
			}
		}
	}
}

Thank you,
Pablo

Posts: 2

Participants: 2

Read full topic

Non-textured color fields fail to persist on macos

$
0
0

@jdhill wrote:

There appears to be an issue on macos Rhino 6 (6.24.20079.23332, 2020-03-19), where non-textured color fields do not retain their values after being changed. To repro:

  1. put the following class into a plugin and build for macos
  2. open Rhino and create a TestEnvironment
  3. set the Test Color to some value
  4. change the value of the Test Double
  5. on update, Test Color will go back to gray

The same can be observed using the SampleCsRdkMaterialAutoUI class if you change the “color” field to non-textured.

[Guid("40504BF1-4308-44D6-B1F8-E6EFEE059B91")]
public class TestEnvironment : RenderEnvironment
{
    public override string TypeName        => "TestEnvironment";
    public override string TypeDescription => "TestEnvironment";

    public TestEnvironment()
    {
        Fields.Add("testDouble", 1.234567, "Test Double");
        Fields.Add("testColor", Color.Gray, "Test Color");
    }

    protected override void OnAddUserInterfaceSections()
    {
        AddAutomaticUserInterfaceSection("Parameters", 0);
    }
}

Posts: 1

Participants: 1

Read full topic

Porting RhinoCommon Windows plugin to OSX

$
0
0

@pkinnane wrote:

Hi

I have installed all the OSX RhinoCommon stuff as per the McNeel docs onto a Catalina Mac. I open my Windows plugin code on Catalina Visual Studio, and there are a bunch of issues. I have decided that the approach I have taken on Windows is probably not going to work on OSX, so I am going back to square one.

First question…

My main (dockable) panel in the Windows version is a UserContol. There does not seem to be a UserControl object on Rhino for Mac. What should I use instead please (keeping in mind I ultimately want the same code to run on Windows and OSX).

Thanks

Paul

Posts: 1

Participants: 1

Read full topic

Rhinocommon access to Options > Keyboard

Python - DeepCopy of custom class instance


Disable IsoCurves as Default

$
0
0

@oguzhankoral wrote:

Hi everyone,

When I add breps onto Rhino Viewport usign with

        if (null != Breps&& Breps.Count > 0)
        {
            var group_index = doc.Groups.Add();
            var attributes = doc.CreateDefaultAttributes();
            attributes.AddToGroup(group_index);

            for (var i = 0; i < Storeys.Count; i++)
                doc.Objects.AddBrep(Breps[i].Brep, attributes);
            doc.Views.Redraw();
            return true;
        }

1 - Can I add to doc breps without their IsoCurves?
2 - Is there any way to hide sew line (I dont know the name of it) ?

Thanks in advance,
-Oğuzhan

Posts: 2

Participants: 2

Read full topic

Eto Froms TreeGridView drag and drop

$
0
0

@marton.parlagh wrote:

Hello,

Is there an easy way to do row-reordering/row drag and drop between TreeGridView rows?

I see a GetDragInfo function, but it is not clear how could I use it.

I guess I could use DragEnter,DragDrop etc events, but under OSX these are not working for me.

Márton

Posts: 1

Participants: 1

Read full topic

Arc center IJ

$
0
0

@MatrixRatrix wrote:

Hello I need add a arc with starPoint/endPoint and center ij :slight_smile:

                Rhino.Geometry.Point3d start = new Rhino.Geometry.Point3d(0, 0, 0);
                Rhino.Geometry.Point3d  end = new Rhino.Geometry.Point3d(0, 500, 0 );
                Rhino.Geometry.Point3d Center = new Rhino.Geometry.Point3d(-106, 250, 0);
                Rhino.Geometry.Arc arc = new Rhino.Geometry.Arc(start, Center, end);
                doc.Objects.AddArc(arc);

There is any away?

Posts: 6

Participants: 3

Read full topic

Using Eto and Python in Visual Studio Code

$
0
0

@shanel wrote:

I am writing a series of python scripts for my workflow. However, I find Rhino Python Editor very limiting in functionality. I have switched to using Visual Studio Code using CodeListener and RhinoPython for VSCode for the time being and it seems to work ok.

However, I started a script using Eto forms and I cannot get Eto to autocomplete or be recognized as a module in Visual Studio Code. I know it is a .NET library, but I’ve looked around and I seem to be missing some key info on how Eto can be integrated into my python process using VSCode.

How can I get Eto to show in VSCode as a python module that I can use intellisense with? Would it be easier with Visual Studio 2015?

Also, I am wondering if, with all these complications, if it would be better to find a C# workflow. I’m not great at C#, but this could be a good opportunity to learn.

Posts: 1

Participants: 1

Read full topic

WindowsForms vs Eto.Forms

$
0
0

@oguzhankoral wrote:

Hi everyone,

I want to create my plugin as Rhino Panel. So I am using the Eto.Forms.Panel library for it. When I use WindowsForms, it is really easy to arrange buttons, labels and their properties etc… Thanks to ToolBox of Windows Forms as you can see image below,

The question is, Do Eto.Forms have these ToolBox? If Eto.Forms use WindowsForms as base, I thought it should be. I am open for any suggesstion beside this.

Thanks in advance
-Oğuzhan

Posts: 4

Participants: 3

Read full topic

Viewing all 8573 articles
Browse latest View live