s my code, so I decided to write a new simple component refreshing all time at 300 ms interval and the problem came up again. The code provoking the display exceptions and images with the erros are listed below.
----------------------------------------------------------------------------------------------
using System;using System.Drawing;using Grasshopper.Kernel;using FirstComp.Properties;using System.Timers;namespace FirstComp{ public class FirstCompGH : GH_Component { private Timer myTimer = new Timer(300); //3 veces por segundo private Random rand = new Random(DateTime.Now.Millisecond); public FirstCompGH() : base("Nombre", "Abreviado", "Descripcion", "Categoría", "SubCat") { myTimer.Elapsed += new ElapsedEventHandler(MainLoop); myTimer.Start(); } protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) { pManager.Register_DoubleParam("Op A", "A", "Primer parámetro de la operación",0.0); pManager.Register_DoubleParam("Op B", "B", "Segundo parámetro de la operación",0.0); } protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) { pManager.Register_DoubleParam("Suma", "S", "Resultado de la suma"); pManager.Register_DoubleParam("Resta", "R", "Resultado de la resta"); pManager.Register_DoubleParam("Mult", "M", "Resultado de la multiplicación"); pManager.Register_DoubleParam("Div", "D", "Resultado de la división"); } protected override void SolveInstance(IGH_DataAccess DA) { // Variables para contener los datos de entrada // Le podemos asignar algunos valores iniciales. double opA = double.NaN, opB = double.NaN; // El objeto DA recupera los datos de la entrada. // Si no hay datos de entrada abortamos. if (!DA.GetData(0, ref opA)) { return; } if (!DA.GetData(1, ref opB)) { return; } opA += rand.Next(1,10); opB += rand.Next(1,10); // Ahora realizamos las operaciones matemáticas DA.SetData(0, (opA + opB)); DA.SetData(1, (opA - opB)); DA.SetData(2, (opA * opB)); if (opB != 0) //Rhino.RhinoMath.ZeroTolerance DA.SetData(3, (opA/opB)); else { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Error de división por cero"); return; } } public override Guid ComponentGuid { get { return new Guid("44BEA3FE-7CB8-42fe-AEC9-BE5F6EE424E8");} } protected void MainLoop(object source, ElapsedEventArgs e) { this.ExpireSolution(true); } protected override Bitmap Internal_Icon_24x24 { get { return Resources.icono; } } }}
-------------------------------------------------------------------------------------------------
Images showing errors.
I can't figure out what is causing these errors.
Best Regards
Ernesto
…
j
1
c
e
h
k
2
f
-------------------------------------------------------------------------------------------------
To these...
0;0
0;1
0
a
i
------------------------------------------------------------
0;0
0;1
0;2
0
b
g
j
1
c
h
k
------------------------------------------------------------
0;0
0
d
1
e
2
f
------------------------------------------------------------
Thanx……
st variety of papers (mostly related with LIDAR airborne sampled clouds) ... but ... hmm ... no code (other than some "abstract" algos that may (or may not) work). Reason? A very hot cake that one these days: from reverse engineering to DARPA founded future defense systems and up to cruse missiles pattern recognition algos.
The solution (obviously doable only via code) is the so called flat hard clustering ... were points are sampled into clusters based on the coPlanarity "rule". For large amounts recursive octTrees (an oriented box divided in 8 "partitions") subdivisions are used and then pts are processed in parallel (and then clusters are re-evaluated in order to "absorb" other clusters with same plane A,B,C,D vars etc etc).
See what's happening in a very carefully made test point collection:
3.7 ms and the "ideal" clustering (7 search loops VS the max 42M theoretical threshold):
Depending on the pts "preparation" ... a considerable more time/search loops is required ... and ... well ... also "valid" clusters (4 points and up) made:
So "ideally" speaking in your case:
1. Mesh faces center points (or alternatively: mesh vertices) are sampled into a pts collection .
2. Hard flat coPlanarity clustering is attempted yielding pts/planes in equivalent DataTrees.
3. Planar Breps are made with respect the planes (like the black things captured above) and sampled, say, into a breps List.
4. The method Brep[] solids = Brep.CreateSolid(breps); is used for attempting to create your desired "engulfing" brep. This method is very slow mind (other waaaay faster approaches also available).
…
nd the tool can create a single surface having the texture of the original input surfaces. (Visualize two waves interacting on the surface of a body of water.) But a surface intersection operations is producing unexpected results, putting my entire algorithm at risk of failing.
I’ve enclosed a .GH that has a simplified version of the algorithm I intended to use to produce a single surface from the two input surfaces. How it works is to use the Brep | Brep component to generate a set of curves where the input surfaces meet. I then apply these cutting curves to a Surface Split component on each input surface. I intended to then programmatically cull the set of brep’s from the split operations, removing all those that aren’t on the face of the target surface. Finally, I would join all the remaining prep’s into a synthesized surface that reflects the facial interactions of the originals. This algorithm is however not completing successfully because the outputs of the Brep | Brep don’t appear to accurately reflect the complete set of curves at the intersections of the 2 faces. I think it’s because of these incomplete set of curves that the Surface Split operations are returning a very incomplete set of sub-surfaces. This sparse set of results don’t allow me to reassemble the sub-surfaces to form a complete synthesized face. This posting includes the Grasshopper document, as well as a screenshot of the GH code. The GH Intersection and split operations take a long time to complete. So I’ve enclosed Bake’d versions of the important geometries in the layers of the 3dm document as indicated below. But this results in a 12MB document, which is larger than the discussion can handle. But i can be downloaded from here. (my Google drive) Scaled Waves - Layer 1 Brep | Brep out - Layer 2 top Surface Split out - Layer 3 bot Surface Split out - Layer 4 I think there are problems in Rhino/Grasshopper related to intersections and splits. But I’m also open to somebody suggesting a better way to accomplish my objective — including workarounds. Thanks for any help, - Bob…
Added by neobobkrause at 8:46pm on August 31, 2016
ing results and I think it is based on the assumption of small displacements. That’s why I want to try with LaDeform.
But doing this I met some problems. I tried to experiment it on the small examples that are provided with Karamba:
1.LaDeform in load-controlled behavior
I know Karamba has mainly been created make form-finding and not properly precise calculations, but I’d like to evaluate deformations of my structure under certain loads (load-controlled). It is said to let it in Default value for MaxDisp (-1).
[Rhino view for deflection of the rope]
In this example derived from a Karamba example (Large_Deformation_Rope.gh), the programs shows different ways to get approximately equal max deflection. But, getting into it, I realized Load Multiplier for gravity is different from one model to another (-3.237 for Analyze TH1 and -134 for LaDeform). So what is the interest of the example if the quite similar shape of deflections are not got under the same loadings? (quite different loadings indeed)
Doesn’t it show on the contrary that LaDeform algorithm does not work properly, if you need to change the load multiplier?
The Grasshopper file is shown below.
2.MaxDisp
When I use the model is “max disp”, I command the deformation, but how can I get the value of the virtual force exerted (which I don’t know because it is now imposed)? What is its link with the imposed deflection?
Otherwise I can’t figure how to use it with displacement-controlled loading
3.Iterative process
As it seems impossible to use LaDeform process, I tried to test it by iterations, as you recommend it on the forum, saying that it is equivalent to an iterative Analyze Th1 process.
I tried to reproduce this loading but the result is not very enthusiastic as you can see. The Rhino file shows the progressive loading, with the corresponding Grasshopper files, where I
- disassemble the model,
- get the previous deformed model
- put in another part of the load,
- re-assemble and then calculate it on the previous deformed shape.
Do you have any idea why the answer is not the same ? (LaDeform seem to give like 5 times less for the same loadings) (and even controlling it by displacements the shapes do not fit the principle of the algorithm would let think)
[RhinView for Iterative process]
First step by analyze Th1, and result by LaDeform
4.Analyze Th1 after LaDeform?
Some tutorials of Karamba show that an analysis with Analyze Th1 is sometimes made immediately after a calculation in large deformations. What is its reason? It seems to sometimes change considerably the result. What is the sense of such an operation? Would it mean that LaDeform is not trustworthy?
ð My question is then: is there a way to make the use of LaDeform for other purposes than form-finding affordable and coherent? If I mistake using it, where?
Thank you very much for your help,
…
etric/parəˈmɛtrɪk/adjectiverelating to or expressed in terms of a parameter or parameters.art/ɑːt/nounthe expression or application of human creative skill and imagination, typically in a visual form such as painting or sculpture, producing works to be appreciated primarily for their beauty or emotional power.// Summer School 2017 3 day intensive workshop for design students & professionals will delve into computational & parametric methods (using Rhino3D & Grasshopper3D) to create data-driven art installations, physically manifested into a space through hands-on fabrication & assembly.The experimental studio will run across 2 cities in India (New Delhi & Mumbai) and investigate the agenda of ‘filling the void’ at art installation scale, through the use of computation and parametric methods. Studio is designed as a 3-day event in both cities comprising of technical tutorials, teaching sessions, prototyping & presentations culminating in a symposium / round-table conference / open discussion with leading / emerging professionals that demonstrate computation, parametric design or alternative techniques in their work / practice / academia. // Cities & Dates*New Delhi – 30th June to 2nd July 2017 (Friday to Sunday)Mumbai – 7th July to 9th July 2017 (Friday to Sunday)//VENUE: DELHI: Startup Tunnel, Vihara Innovation CampusD-57, 100 Feet Rd, Pocket D, Dr Ambedkar Colony, Chhattarpur, New Delhi - 110074MUMBAI: Raffles Design International, MumbaiHi Life, 2nd Floor, Phirozshah Mehta Road,Santacruz (W). Mumbai – 400054// Registration DatesAll Registrations End 4 days prior to workshop start date (Or till seats last)// About rat[LAB] EDUCATIONrat[LAB] EDUCATION is an initiative by rat[LAB]-Research in Architecture & Technology (www.rat-lab.org) to start a new discourse in architecture & parallel design disciplines with the use of ‘computational design’ & it’s various subsets. Spread across various cities / countries, we are establishing a global dialogue in the domain of computational design by actively organizing and participating in workshops, lectures, presentations & symposia. While rat[LAB] has taken a top-down approach of exploring computational design through industry, a parallel, bottom-up approach is also in-line to involve students of all levels, from design & related backgrounds.…
s for architectural design, has been heralded as the new paradigm in architecture for the last decade. Digital design techniques coupled with rapid prototyping have permeated architectural education and practice at all levels. But, besides the endless rhetoric and baseless forms, what can these methods actually contribute to the field? What is the scope of their use?
This workshop seeks to answer these questions by investigating surfaces, surface mathematics and manipulations, and using this investigation to introduce students to the issues of design and fabrication of artifacts.
The workshop will thus introduce participants to the basic concepts for design utilizing scripting techniques, through the exploration of the Python language for Rhinoceros. Together with the study of syntax, data types and scripting techniques the focus will be put on the understanding of the digital tools in relation with the common practice and the ways to approach problems a designer might encounter while using them.
Examples of a previous similiar workshop can be found here
Details: Instructors: Marina Konstantatou (University College London), Pierluigi D’Acunto (ETH Zurich), Vincenzo Reale(Zaha Hadid Architects + Architectural Association London), Giancarlo Torpiano (Architectural Association London) *At least two tutors will be present during the workshop Language: English Schedule: 15 – 16 – 17 MAY 2013 // 9.00 – 18.00 Organizers: SMD + LaTiendaDelCAD + PeQuod Venue: McNeel Europe Offices, c/ Roger de Flor 32-34, 08018 Barcelona (map)
Software: Rhinoceros 5 Grasshopper 0.9.0014 Python Component for Grasshopper
Every participant should bring his or her own laptop with the software installed. In the class will be also computers in case any participant could not bring a laptop.
Links to the softwares will be facilitated to participants once they get into the registration process.
Registration: Students* : 395€ (+vat) Professionals: 495€ (+vat)
Early bird promo
Registrations made before 22nd April will get a discount over the price:
Early Bird promo Student* : 295€ (+vat) Early Bird promo Professional: 395€ (+vat)
For registry, please visit la TiendaDelCAD website
* Students will have to proof their status with a student ID
The course will be confirmed as soon as the minimum number of participants is reached, and no later than the 29th April. There will be places for a total of 14 participants.
Venue: McNeel Europe Offices, c/ Roger de Flor 32-34, 08018 Barcelona…
metric/parəˈmɛtrɪk/adjectiverelating to or expressed in terms of a parameter or parameters.art/ɑːt/nounthe expression or application of human creative skill and imagination, typically in a visual form such as painting or sculpture, producing works to be appreciated primarily for their beauty or emotional power.// Summer School 2017 3 day intensive workshop for design students & professionals will delve into computational & parametric methods (using Rhino3D & Grasshopper3D) to create data-driven art installations, physically manifested into a space through hands-on fabrication & assembly.The experimental studio will run across 2 cities in India (New Delhi & Mumbai) and investigate the agenda of ‘filling the void’ at art installation scale, through the use of computation and parametric methods. Studio is designed as a 3-day event in both cities comprising of technical tutorials, teaching sessions, prototyping & presentations culminating in a symposium / round-table conference / open discussion with leading / emerging professionals that demonstrate computation, parametric design or alternative techniques in their work / practice / academia. // Cities & Dates*New Delhi – 30th June to 2nd July 2017 (Friday to Sunday)Mumbai – 7th July to 9th July 2017 (Friday to Sunday)//VENUE: DELHI: Startup Tunnel, Vihara Innovation CampusD-57, 100 Feet Rd, Pocket D, Dr Ambedkar Colony, Chhattarpur, New Delhi - 110074MUMBAI: Raffles Design International, MumbaiHi Life, 2nd Floor, Phirozshah Mehta Road,Santacruz (W). Mumbai – 400054// Registration DatesAll Registrations End 4 days prior to workshop start date (Or till seats last)// About rat[LAB] EDUCATIONrat[LAB] EDUCATION is an initiative by rat[LAB]-Research in Architecture & Technology (www.rat-lab.org) to start a new discourse in architecture & parallel design disciplines with the use of ‘computational design’ & it’s various subsets. Spread across various cities / countries, we are establishing a global dialogue in the domain of computational design by actively organizing and participating in workshops, lectures, presentations & symposia. While rat[LAB] has taken a top-down approach of exploring computational design through industry, a parallel, bottom-up approach is also in-line to involve students of all levels, from design & related backgrounds.…
or a couple of thingies.
Pattern.gh
I defined parametrically a triangle which I then smoothed out to become more like a blob shape. After that I created a pretty simple pattern that I had in my mind (costed me a lot of time to make this in GH) and finally wanted to rotate each element as it goes higher . The dispatching part seems to be working pretty slow, so it might need an optimization, but I’m still happy with the result as it shows exactly what I wanted, so this is a minor issue in my case.
I then decided to try tessellating my extrusions. You’ll see the voronoi script which is a blob-group in the same Pattern.gh:
I had an idea of something and started the code from scratch, then decided to watch tutorials and implement the code shown there. I somehow coped to combine my code with this in the tutorials, but since my knowledge of Grasshopper is zero to basic my code seems to be very unoptimized and lagging.. When dragging the sliders, it takes a lot of time to compute the changes, although, I’m working on a 24gigs 6th gen i7 machine. It might also need optimization.
Here comes the first tricky part that I couldn’t sort out in an elegant way neither in Grasshopper nor in Rhino. I want a smooth transition between the wall and the ceiling, so that the voronoi tessellation doesn’t get interrupted. If I was to do it in Rhino I’d make a curve with a filleted edge which I’d then revolve/sweep along a rail.
Pattern.gh:
Second thing is – I’ve defined a shape which I want to rotate at a certain degree as it goes higher, however, I don’t have the knowledge to make this happen automatically and just copy the script over and over again. Is there a chance to somehow “loop” the code and parametrically define the degree of rotation and amount of units in the loop?
Next thing is I want to somehow be able to rotate each “6-storey-building” dependently on its surrounding buildings, so that their “terraces” never overlap. I’m using quotes, since they’re still some silly shapes that have nothing to do with buildings and terraces. The principle has to be something like gear wheels or the so-called rack wheels . There has to be some pace which I could set parametrically, but I’m still unsure how to do that in Grasshopper.
The pre-last thing is that I want to control the height of each “building” based on let’s say a topography. I presume this could be done somehow with height maps or some gradient mapper connected to curvature analysis. Not really sure how something like this would work, but I’ve seen such codes that control height depending on a variable.
The last one is more or less similar to the previous. I want to be able to “dissolve” the pattern that I initially created and make it irregular. I suppose this could be done with attractor curve, but again this is just a guess. Please note that this is a top view and the shapes on the upper-left corner have got more "wings" which means there is more floors in the according building. Let's say the buildings in the upper-left corner are 6-7 floors high, in the middle are 4-5 and to the right they're only 3 floors high.
Sorry for that many questions in a single thread. Please let me know if I have to split them in separate threads. All this information is needed for learning purposes. I’m now preparing myself for my bachelor thesis and try as much things as I could, so that I’ll be ready for the final stage of my bachelor’s degree.
Many thanks in advance! Cheers!…
.
Things have been working swimmingly in many areas of the plugin, but one particular problem has been tough to solve. I have two components that are trying to read/write to the same memory at the same time, causing Rhino exceptions and crashes.
The conflicts appear to be happening between two components -- one is a "Layer Events Listener" that reports essentially what type of layer event just happened. The other is a "Set Layer Visibility" component that toggles the visibility of a list of layers.
The code:
public class LayerTools_LayerEventsListener : GH_Component { /// <summary> /// Initializes a new instance of the LayerTools_LayerListener class. /// </summary> public LayerTools_LayerEventsListener() : base("Layer Events Listener", "Layer Listener", "Get granular information about the layer events happening in the Rhino document.", "Squirrel", "Layer Tools") { }
/// <summary> /// Registers all the input parameters for this component. /// </summary> protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) { pManager.AddBooleanParameter("Active", "A", "Set to true to listen to layer events in the Rhino document.", GH_ParamAccess.item, false); pManager.AddTextParameter("Exclusions", "E", "Provide a list of exclusions to stop reading specific events (Added, Deleted, Moved, Renamed, Locked, Visibility, Color, Active).", GH_ParamAccess.list); pManager[1].Optional = true; }
/// <summary> /// Registers all the output parameters for this component. /// </summary> protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) { pManager.AddBooleanParameter("Initialized", "I", "Whether the listener changed from passive to active.", GH_ParamAccess.item); pManager.AddTextParameter("Document Name", "doc", "Name of the Rhino document that is changing.", GH_ParamAccess.item); pManager.AddTextParameter("Layer Path", "path", "Path of the modifed layer.", GH_ParamAccess.item); pManager.AddIntegerParameter("Layer Index", "ID", "Index of the modified layer.", GH_ParamAccess.item); pManager.AddIntegerParameter("Sort Index", "SID", "Sort index of the modified layer.", GH_ParamAccess.item); pManager.AddTextParameter("Event Type", "T", "Type of the modification.", GH_ParamAccess.item); pManager.AddBooleanParameter("Added", "A", "If the layer has been added.", GH_ParamAccess.item); pManager.AddBooleanParameter("Deleted", "D", "If the layer has been deleted.", GH_ParamAccess.item); pManager.AddBooleanParameter("Moved", "M", "If the layer has been moved.", GH_ParamAccess.item); pManager.AddBooleanParameter("Renamed", "R", "If the layer has been renamed.", GH_ParamAccess.item); pManager.AddBooleanParameter("Locked", "L", "If the layer locked setting has changed.", GH_ParamAccess.item); pManager.AddBooleanParameter("Visibility", "V", "If the layer's visibility has changed.", GH_ParamAccess.item); pManager.AddBooleanParameter("Color", "C", "If the layer's color has changed.", GH_ParamAccess.item); pManager.AddBooleanParameter("Active", "Act", "If the active layer has changed.", GH_ParamAccess.item); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { bool active = false; List<string> exclusions = new List<string>();
DA.GetData(0, ref active); DA.GetDataList(1, exclusions);
RhinoDoc thisDoc = null;
bool initialize = false;
string dName = null; string activePath = null; int layerIndex = -1; int sortIndex = -1; string eventType = null; bool added = false; bool deleted = false; bool moved = false; bool renamed = false; bool locked = false; bool visibility = false; bool color = false; bool current = false;
if (active) { thisDoc = RhinoDoc.ActiveDoc;
initialize = (!previouslyActive) ? true : false;
RhinoDoc.LayerTableEvent -= RhinoDoc_LayerTableEvent; RhinoDoc.LayerTableEvent += RhinoDoc_LayerTableEvent; previouslyActive = true;
} else {
RhinoDoc.LayerTableEvent -= RhinoDoc_LayerTableEvent; previouslyActive = false; }
if (ev != null) { dName = ev.Document.Name; layerIndex = ev.LayerIndex; eventType = ev.EventType.ToString();
if (!exclusions.Contains("Active")) { if (ev.EventType.ToString() == "Current") { // active layer has just been changed current = true; }
}
if (!exclusions.Contains("Moved")) { if (ev.EventType.ToString() == "Sorted") { // active layer has just been changed moved = true; }
}
if (!exclusions.Contains("Added")) { if (ev.EventType.ToString() == "Added") { // layer has just been added activePath = ev.NewState.FullPath; added = true; }
}
if (!exclusions.Contains("Active")) { if (ev.EventType.ToString() == "Deleted") { // layer has just been added
deleted = true; } }
if (ev.EventType.ToString() == "Modified") { // layer has been modified activePath = ev.NewState.FullPath;
//skip sortindex eventType = ev.EventType.ToString();
if (ev.OldState != null && ev.NewState != null) { if (!exclusions.Contains("Locked")) { if (ev.OldState.IsLocked != ev.NewState.IsLocked) locked = true;
} if (!exclusions.Contains("Visibility")) { if (ev.OldState.IsVisible != ev.NewState.IsVisible) visibility = true; }
if (!exclusions.Contains("Moved")) { if (ev.OldState.ParentLayerId != ev.NewState.ParentLayerId) moved = true; }
//if (ev.OldState.SortIndex != ev.NewState.SortIndex) moved = true; if (!exclusions.Contains("Renamed")) { if (ev.OldState.Name != ev.NewState.Name) renamed = true; }
if (!exclusions.Contains("Color")) { if (ev.OldState.Color != ev.NewState.Color) color = true; } }
} }
DA.SetData(0, initialize); DA.SetData(1, dName); DA.SetData(2, activePath); DA.SetData(3, layerIndex); DA.SetData(4, sortIndex); DA.SetData(5, eventType); DA.SetData(6, added); DA.SetData(7, deleted); DA.SetData(8, moved); DA.SetData(9, renamed); DA.SetData(10, locked); DA.SetData(11, visibility); DA.SetData(12, color); DA.SetData(13, current);
}
static bool previouslyActive = false; Rhino.DocObjects.Tables.LayerTableEventArgs ev = null;
void RhinoDoc_LayerTableEvent(object sender, Rhino.DocObjects.Tables.LayerTableEventArgs e) { ev = e;this.ExpireSolution(true); }
And for the layer visibility component:
public LayerTools_SetActiveLayer() : base("Set Active Layer", "SetActiveLayer", "Set the active layer in the Rhino document.", "Squirrel", "Layer Tools") { }
/// <summary> /// Registers all the input parameters for this component. /// </summary> protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) { pManager.AddBooleanParameter("Active", "A", "Set to true to change the active layer in Rhino.", GH_ParamAccess.item, false); pManager.AddTextParameter("Path", "P", "Full path of the layer to be activated.", GH_ParamAccess.item); }
/// <summary> /// Registers all the output parameters for this component. /// </summary> protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) { pManager.AddIntegerParameter("Layer ID", "ID", "Index of layer that has been activated.", GH_ParamAccess.item); pManager.AddBooleanParameter("Status", "St", "True when the layer has been activated.", GH_ParamAccess.item); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { bool active = false; string path = "";
if (!DA.GetData(0, ref active)) return; if (!DA.GetData(1, ref path)) return;
int layer_index = -1; bool status = false;
if (path != null) {
Rhino.RhinoDoc doc = Rhino.RhinoDoc.ActiveDoc; Rhino.DocObjects.Tables.LayerTable layertable = doc.Layers;
layer_index = layertable.FindByFullPath(path, true);
if (layer_index > 0) { // if exists RhinoDoc.ActiveDoc.Layers.SetCurrentLayerIndex(layer_index, true); status = true; } }
DA.SetData(0, layer_index); DA.SetData(1, status); }
Now originally I was getting exceptions when changing multiple layers' visibility properties, which would cause the Event Listener to fire and try to read the Visibility property before the memory has been released by the Set Layer Visibility component. That led me to add an "Exceptions" input, that would allow me to disable the reading of Visibility events at the source in the Layer Events listener. That helped me manage about 95% of the crashes I was getting, but I still get strange crashes in other event properties, even when that property shouldn't be affected. For instance, I am getting a crash here on the Name property in the event from the delegate function, even though I am only changing Visibility at any one time:
I have a few ideas but they all seem pretty hacky. One is to try to set a flag that is readable by any component in the plugin -- so that the event listener can see if a "set" component is currently running and abort before causing an exception. The other is creating a delay in the event listener, somthing like 200ms, to allow any set components to finish what they are doing before reading the event. Neither seems super ideal.
Any ideas?
Thanks,
Marc
…