Calling compute with curl


(Steve Baer) #1

What non-.net implementation would you prefer?


Start here
(Dimitrie) #2

well, let’s say curl for fun. I tried earlier this morning:

  • create a point
  • take point response
  • create a circle around that point
  • fail (point was stuck at 000)

I need to wrap my head properly around this, don’t worry. I haven’t RTFM beyond the first paragraph so to say, so please do ignore the above :smiley:


(Steve Baer) #3

You actually found a bug. Your curl instructions were probably correct. The endpoint for a Circle constructor is overloaded and I’m picking the wrong internal version to call based no your json input. I just ran a test and see the same results.

I have to figure out why {"X":1.0,"Y":2.0,"Z":3.0} is allowable in JSON.Net for being converted into a Rhino.Geometry.Plane


(Steve Baer) #4

This specific test should be working now. I am using the following curl syntax

curl -H "api_token: steve@mcneel.com" -H "Content-Type: application/json" 
-d '[{"X":1.0,"Y":2.0,"Z":3.0}, 12]' https://compute.rhino3d.com/Rhino/Geometry/Circle/New

I need to look into tweaking how JSON.Net serializes classes like Planes and Circles so it isn’t so heavy. Right now JSON.Net just automatically serializes all of the properties which isn’t necessary.


(Dimitrie) #5

It works! Tried it too, got circle in the expected place :sunny:

I had the same headaches with speckle, hence the speckle base geometry types that tend to strip down stuff to minimal properties. Ideally these things can be controlled through json.net decorators elegantly though like [jsonignore] if i recall correctly.


(Steve Baer) #6

I can’t use attributes the way that our server is set up but it looks like there are other pretty simple approaches available.