[Solved] Make 2D Cleanup Lines

Hello everybody,

I’ve been trying to make use of the HiddenLine class from RhinoCommon, to try to recreate the Make2D (Grasshopper) component.

I happen to get a few extra lines (geometry) from my code, which is not the case when I use the default Make2D component. Can someone let me know what I’ve missed?

Also, why is it that the python version-that only creates one type of lines(visible)- slower than the native component-that creates both visible and hidden_lines? Is this a Python vs C# issue?

I’m building my code based on this reference.

File: 2020.12.09 - Make2D Cleanup.gh (121.5 KB)

EDIT: I tried to SolidUnion the input Geometry before passing it to the Python, and the extra lines disappear only if the Union is successful (i.e. if the outcome is a single geometry). But, doesn’t work for nearly-but-not intersecting geometries.

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

Hi,
This is a better sample to follow. It is written in C#. Let us know if you have trouble following.
Sample code…

I actually wrote the same sample in both C# and Python. I get the expected result from the C# component, but not the Python. Not sure why. @piac do you have an idea what might be the issue here?
2020.12.09 - Make2D Cleanup_RI.gh (119.5 KB)

Hi Rajaa,

Thank you for your reply. I noticed that the C# script has a foreach loop (Line 38). So, I changed the geometry to ListAccess and added a similar loop. It seems to work as expected now.

FILE: [2020.12.10 - Make2D Cleanup {Solved].gh|attachment](upload://tzqCCZgwF8VL4fP1w8p7deJyhIP.gh) (118.0 KB)

FILE(alt): … unable to upload file to discourse.

Also, regarding the computation time, I find that the

    h1 = Rhino.Geometry.HiddenLineDrawing. Compute(hd , True )

line takes the maximum time, in calculating all types of lines irrespective of what we require. We then filter the ones we need and display them (if I’m not wrong). Is there any way to tweak that to compute only crv_vis lines?

Since I’m trying to automate >400 Drawings, with my current speed at 60 seconds per drawing. (~ 6 Hours of not knowing if the program froze, or it’s computing)

Thanks!

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

Ok, I see it now, the Python was processing the result one object at a time.
You can try to set “IncludeHiddenCurves” to false and see if that makes a difference.

1 Like

Incredible! I added this line to the parameters

hd.IncludeHiddenCurves = False

and now the computation time is less than 500ms.

Thanks a ton!

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

What is the way to input a Rhino View into the C# component like this:
image ?

Have you tried setting the input-type to System.Object? It should work that way.

~ ~ ~ ~ ~ ~ ~ ~
Kaushik LS
Chennaim IN.

OK, thank you!

1 Like