algorithmic modeling for Rhino
For Python's unique node in code feature, so many components now have little banners at the bottom that allow right-click options to be set. For instance, CullDuplicates (CullPt):
CullDuplicates works in Python:
...and if I print ghc.CullDuplicates(curve_points) I see the actual names of the outputs in the Python editor:
...so I can either do:
a,b,c = ghc.CullDuplicates(curve_points)
...or:
a = ghc.CullDuplicates(curve_points)[0]
b = ghc.CullDuplicates(curve_points)[1]
c = ghc.CullDuplicates(curve_points)[2]
...or even:
a = ghc.CullDuplicates(curve_points).points
b = ghc.CullDuplicates(curve_points).indices
c = ghc.CullDuplicates(curve_points).valence
And multiple inputs are just separated by commas within the parenthesis.
But the component is defaulting to Average instead of Leave One, which doesn't give me much useful. I'm trying to remove duplicate lines quickly, of 25K lines, and this is the fastest component in Grasshopper I've found to do that, by finding the line midpoint then getting the indices output from CullDuplicates to find out which are keepers.
There's no documentation about what Average even means, and it spits out a bunch of -1s, with the resulting lines culled by index of the good numbers being rather odd compared to Leave One, which just works naturally, like a human being would want it to.
Is it possible to change the component mode from Average to Leave One from Python?
Rhinocommon seems to lack a cull duplicate lines/curves command, so I'm hoping Grasshopper components will be faster than raw interpreted (uncompiled) Python.
Tags:
Well ... this is a "bit" off-topic (C#) but give the good old HashSet a spin.
How it works:
1. Creates some random duplicate Lines (Tree).
2. Makes a chaos List out of 1.
3. Does the unique thingy.
Exactly on topic, given the bad node-in-code Python news.
I'll have to study it in detail. Great big clue for a good strategy.
Alas, it is only partially effective, leaving thousands of duplicates still that the Rhino Select Duplicate Objects (SelDup) command finds just fine, as does a little Grasshopper script, possibly due to line direction?:
Can you add the reverse lines too, to the unique line table?
That the very basic removal of duplicate lines isn't in Rhinocommon is just ridiculous. I can hack together a script but must study for days to get one that isn't ruinously slow.
I had thought of hash use, of converting objects to a single value, but forgot the term "hash," only remembering "checksum," and hadn't pursued it.
Hmm ... reversed Lines eh?
You are a tough client > therefor > I'll charge you extra for that: more sardine(*) cans, what else?
(*) Da Morgada, what else?
PS: If the sardines arrive in good shape > V3 MAY do some business via parallel stuff using the HocusPocusParallelus (TM)(C) method.
Not there yet. Rhino and Grasshopper find thousands more duplicates:
Ah, let me feed your test lines into my Grasshopper cluster. They now give the same result, for *your* line collection. There's something odd about my specific groups of lines that Rhino or Grasshopper (via midpoints) can handle but your script ignores? I did internalize the data. I'd appreciate if you can spot the difference that eludes me.
I'll investigate that one ASAP (but since // stuff is Très à la mode > in the meantime prepare the sardines (in pure mineral oil)).
NOTE: the only case where the V2 fails is when it deals with max chord Lines in a sphere and the likes ... but who on Earth could think of that? (you I suspect). But ... wait a minute: what about @#%$@ tolerance matters? (when a mid point ... er ... is "not" the same midpoint).
Moral: life sucks.
more soon
Other than that "minor" tolerance thingy ... did the hashset way improved the processing time? If yes how much?
Obviously I could do it the "orthodox" way (I have a variety of C# for that) ... but the effort here is for something fast and furious.
OK, I have good and bad news:
Good:
This V2A required several lines of code more (about 3) and thus due to the tremendous effort ... blah, blah ... I consider raising my fee by a margin of 666% (give or take a few hundreds ).
I hear you: but you've just added 3 f#%#$g lines: Yes but it's the quality that matters (and greed).
Send the Da Morgada hot stuff ASAP to: The Lord, District 9, North Pole.
Thanks! A rounding factor to the rescue. I had figured that out last night too and am glad it's acceptable practice.
Isn't mineral oil a laxative bug instead of a luxury feature?
"In the Dominican collection, was there not to be found a certain Doctor of Theology, Révérend Père Rouard de Card, a Preaching Brother, who in a brochure entitled:-”Of the Falsification of the Sacramental Substances,” has demonstrated beyond a doubt that the major part of Masses were null and void, by reason of the fact that the materials used in the rite were sophisticated by dealers? For years, the holy oil had been adulterated with goose-grease; the taper-wax with burnt bones; the incense with common resin and old benzoin. But worse than all, the substances indispensable for the holy sacrifice, the two things without which no oblation was possible, had likewise been falsified, – the wine by repeated dilutings and the illicit addition of Pernambuco barc, elder-berries, alcohol, alum, salicylate, litharge; the bread, that bread of the Eucarist that must be kneaded of the fine flour of wheat, by ground haricot-beans, potash and pipeclay! Nay, now they had gone further yet; they had dared to suppress the wheat altogether and shameless dealers manufactured out of potato meal nearly all the hosts! Now God declined to come down and be made flesh in potato flour." – J. K. Huysmans (“Against the Grain” 1883)
Hi Nik,
Currently all node in code python functions only work in its default mode (so right-click-on-component-modes can not be changed).
I think Giulio might be able to answer whether or not this will change once public version of Rhino 6 gets released.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by