We are developing a new command that can take a while to execute and so we want to add a progress bar and the option to cancel the operation. I see that there is the ShowProgressMeter() ( https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_UI_StatusBar_ShowProgressMeter.htm ) method which can be used to display a progress meter in the status bar, but there doesn’t seem to be a built-in way to cancel a command or display a cancel button (next to the progress meter for example) in the RhinoCommon API.
My question is:
Can the the status bar / progress bar be customized using the Eto framework? Or do we need to create our own dialog with progress bar + cancel button if we want to have the cancel option?
I am using DisplayConduit to draw robot Mesh dynamically. It works very well in perspective view. However, when I switch to any of the orthogonal views like “Top”, some triangles of the mesh are displayed “inverted” (see picture below).
Hi - as per the title, I am seeing that whilst Cycles (ie. the Raytraced Viewport is selected) is rendering, the RhinoCommon Rhino.RhinoApp.Idle event is not firing until I pause the cycles render. Is this the intended functionality? It is quite an issue for plugins which rely on the idle event.
I have been trying to embed a Rhino Viewport into my XAML form. I’m thinking the only way to do this will be to create my form with a blank square and add the ViewportControl in during runtime.
I have had a read through and play with SampleCsEtoViewportCommand which was very helpful and tried to add it to my project, this lead me to Eto and as such I have referenced in Eto.dll from the Rhino 7 WIP Folder because the NuGet package seems to have issues.
// SampleCsEtoViewportCommand
`internal class SampleCsViewportForm : Dialog
{
public SampleCsViewportForm()
{
Title = “Rhino Viewport in an Eto Control”;
Resizable = true;
var viewport_control = new
{
new Rhino.UI.Controls.ViewportControl {Size = new Size(400, 200)},
new Rhino.UI.Controls.ViewportControl {Size = new Size(400, 200)}
I have a read through the Eto Wiki on GitHub and found no help in the XAML section XAML Tips & Tricks but I did find a section for how to embed Eto.Forms into another application Embed Eto Forms
However I got stuck there on trying to find more on the .ToNative() property that seems to convert an Eto Form to a Windows Form.
On my Skin/Plugin I need to control the extensions that are going to be saved, or override the rhino save dialog box.
On my plugin I create a custom save dialog and solve my problem, but the only problem is when the document is modified and the rhino is closed by the “cross”, is always pointing to the rhino save dialog .
Hello!
I am currently learning about C#, and I am wondering whether some of the components could be replaced by code in C#.
I am working on this script, and I want to write a program that will perform the same function as gradient and return the material. I have already replaced three of the components, yet I am struggling with this one. Can you please help ?
The vague idea of what I want to do:
List<Line> lines = new List<Line>();
lines.Add(inputLine);
DivideAndRotate(inputLine, ref lines, angle, minLength);
Lines = lines;
//Substituting the length component
List<double> lengths = new List<double>();
foreach (Line itemLine in lines)
{
lengths.Add(itemLine.Length);
}
Lengths = lengths;
//substituting the Bounds component
double minValueBounds = lengths.Min();
double maxValueBounds = lengths.Max();
Interval bounds = new Interval(minValueBounds, maxValueBounds);
Domain = bounds;
//substituting the remap component
List<double> remaps = new List<double>();
foreach(double length in lengths )
{
remaps.Add(RemapValues(length, minValueBounds, maxValueBounds));
}
Remap = remaps;
//I am not really sure if I should use one of these methods, and which one?
// How should I do the Gradient function?
//Rhino.Display.DisplayMaterial material = new Rhino.Display.DisplayMaterial();
//material = material.Specular(System.Drawing.Color.Lime);
Rhino.DocObjects.Material material = new Rhino.DocObjects.Material();
//material.EmissionColor(System.Drawing.Color.Lime);
material = Rhino.DocObjects.Material.DefaultMaterial;
material.SpecularColor = System.Drawing.Color.Lime;
//material.Name = "MyMaterial";
Material = material;
Hi, I have problems scripting the -_Import command inside of a plugIn.
I have read through multiple posts with similar issues, the typical solutions where to
Write a Command and
Set the CommandStyle to ScriptRunner
my problem is a bit different though:
I run a server that listens for pings on a port and fires events from which i want to to a file import.
Since the file format -(for now)- is .fbx, which can only be imported via script I need to call RhinoApp.Runscript().
The approach i tried
Create a Command in my PlugIn: XXImportFBX with CommandStyle set to Scriptrunner
Give the Command a backing field for the FilePath
Insice the Command call RhinoApp.Runscript($"-_Import \"{path}\" ")
When I catch an Import event, set the backing field to the appropriate FilePath and call RhinoApp.ExecuteCommand(_doc, "XXImportFBX")
This does not work, the command runs but RhinoApp.RunScript just returns false, which I assume is related to this:
When I just type the command name in the commandline, after the FilePath field has been populated everything works fine, so it seems Rhino prohibits calling commands like I try to do it here.
No errors are thrown at any point, RhinoApp.Runscript() returns false, and RhinoApp.ExecuteCommand() returns Result.Success.
Is there any way I can achieve command execution from a non-command-class?
Since the event stream comes from another application I would rather not have the user run a blocking command inside of rhino which freezes the UI until they click something in said other application.
Since you helped in many other posts related to RhinoApp.Runscript() problems I’m pinging you directly @dale, I hope you don’t mind.
Also the zipped files in this post, seemed like they might also be related to the problem I’m having here, as the UI is also on another thread and can’t be a command class:
Hi Everyone.
I was working around the dynamic display in RhinoPython starting with the point display provided as an example, trying to adapt it to the following problem but without any success. I need to be able to move a circle center with the mouse while constraining it to a non planar polysurface, with the preview circle plane and circle remaining tangent to the surface at the center point as it moves. Has anyone encountered and solved this ?
Thanks !
Phil
I am changing some of the attributes of the RhinoObject in User Text window manually. After change of certain UserStrings, some other strings are changed as well via Event Watcher Class.
However, I cannot see an update immediately when having focus in the same window. In order to see effect, I need to switch to other window like Object or Material and then back. How to force an update of the values in User text window without switch?
I am already using CommitChanges however still need to switch to other window and back.
I find there is a crash occurring (in 6.26.20118.17211, and 7.0.20119.13305, at least when loading a V6-sdk plugin) when using an Eto LinkButton in a RenderContent UI. To repro, put these classes in a test plugin:
[Guid("0182E9AA-8A98-44A2-B0C1-38639C162635")]
[CustomRenderContent(IsElevated = true)]
public class LinkTestMaterial : RenderMaterial
{
public override string TypeName => "Link Test";
public override string TypeDescription => "Link Test";
protected override void OnAddUserInterfaceSections()
{
AddUserInterfaceSection(new LinkTestUI());
}
}
public class LinkTestUI : EtoCollapsibleSection
{
public override Guid PlugInId => TestRenderPlugIn.PlugInId;
public override LocalizeStringPair Caption => new LocalizeStringPair("Attrs", "Attrs");
public override int SectionHeight => 50;
public LinkTestUI()
{
Content = new TableLayout { Rows = { new LinkButton { Text = "link" } } };
}
}
With the plugin loaded, follow these steps:
1. open the Materials panel
2. create a Link Test material
3. click the link in the material's UI
4. create a Plaster material
5. if it does not crash, select the Link Test material and repeat steps 3-5
There are other actions you can use to trigger it after clicking the link, such as clicking the Back button, or saving with the material in the document, re-opening, clicking the link and closing Rhino (need to save/reopen because the close without saving dialog appears to prevent the crash).
Each method may be somewhat intermittent, but will eventually (should be first or second try) crash with the exception message 'System.Windows.Documents.Hyperlink' is not a Visual or Visual3D.' with the top of the stack trace being:
at MS.Internal.Media.VisualTreeUtils.AsVisual(DependencyObject element, Visual& visual, Visual3D& visual3D)
at System.Windows.Media.VisualTreeHelper.GetParent(DependencyObject reference)
at RhinoWindows.Controls.WpfElementHostBase.<>c.<.ctor>b__1_1(Object sender, KeyboardFocusChangedEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
Is there a way to save a sticky dictionary between rhino sessions?
I have a script where I am creating quite a large dictionary of objects that is being made from a main script and saved within a sc.sticky to pass this information between a number of smaller scripts.
The issue is when I close Rhino this is lost, and I then need to rerun the large script each time I reopen Rhino even though I havent changed anything within the model.
My first thought was to save this as json in the document user text, but the dictionary also contains objects that aren’t easily converted into text.
Thanks
i’m wondering whats the best way to export selective data as STEP file with the new *Rhino.FileIO.FileStp.Write()
Method.
Do i need to create a new docobject & copy all relevant data into it, or is there a fast solution similar to
*fwo=Rhino.FileIO.FileWriteOptions()
*fwo.WriteSelectedObjectsOnly=True
I ran into a group of problems and ask for help. First, I need to use the NonManifoldMerge command for the selected objects (Imprint between surfeaces (command)) on my video I call it without problems, but I don’t know how to call it using the Rhino C # API. After I need to make Mesh for these objects as shown in the video. Here is my code for creating a Mesh, but it still doesn’t appear in Rhino itself.
protected override Result RunCommand (RhinoDoc doc, RunMode mode)
{
doc.Views.RedrawEnabled = false;
List <ObjRef> objRef = new List <ObjRef> ();
using (GetObject go = new GetObject ())
{
go.SetCommandPrompt ("Select objects");
go.GeometryFilter = ObjectType.Surface;
go.GroupSelect = true;
go.GetMultiple (1, 0);
if (go.CommandResult ()! = Result.Success)
{
return go.CommandResult ();
}
for (int i = 0; i <go.ObjectCount; i ++)
{
objRef.Add (go.Object (i));
}
}
foreach (var item in objRef)
{
if (doc.Objects.Find (item.ObjectId) is RhinoObject rhinoObject)
{
MeshingParameters meshingParameters = new MeshingParameters
{
Tolerance = 0.01,
MaximumEdgeLength = 5
};
rhinoObject.CreateMeshes (MeshType.Render, meshingParameters, true);
}
}
}
doc.Views.RedrawEnabled = true;
doc.Views.Redraw ();
return Result.Success;
}
After I need to use the TriangulateMesh command using the Rhino C # API. If anyone has ideas on how to solve these problems, I will be very grateful in advance thanks))
hi,
I used Brep.CreateContourCurves() but there are more contours created than the number of section planes. The input planes are 78 and output curves are 91.
I have created a stand-alone app to manipulate Rhino files using the Rhino3dmIO package. I have been asked to add the ability to export a 3dm file to an obj and/or stl file.
I don’t see an immediate solution to this. Is there a way to do it? I’m not really a cad guy, so I admit I don’t know all the ins & out of this.