Trying to create a point, create a sphere at that point, then setting the radius
in point wrangle;
int centerPT = addpoint(0,origin);
int centerSphere = addprim(0,“sphere”);
now how do I set the radius?
creating a sphere prim and setting its radius
4767 4 1-
- Navjit Gill
- Member
- 3 posts
- Joined: Aug. 2014
- Offline
-
- neil_math_comp
- Member
- 1743 posts
- Joined: March 2012
- Offline
This seems to work, (as long as you press the “Creates spare parameters for each unique call of ch()” button to the right of the VEXpression text field and move the slider).
Hopefully that's what you were looking for.
Edit: Just a note that
vector origin = {0,0,0};
int pt = addpoint(geoself(), origin);
// NOTE: Spheres need a vertex connected to a point, else they won't be created.
int prim = addprim(geoself(), "sphere", pt);
float radius = chf("radius");
// Set the "transform" intrinsic to be the 3x3 identity matrix times the radius.
setprimintrinsic(geoself(), "transform", prim, radius*matrix3(ident()));Hopefully that's what you were looking for.

Edit: Just a note that
0does work in place of geoself()too, since geoself()just gets replaced with 0anyway. I just use geoself()as a clear reminder to myself that it's referring to the output 0, which can't be read, instead of the input 0, which can't be written-to.
Edited by neil_math_comp - July 17, 2017 17:27:34
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
-
- Navjit Gill
- Member
- 3 posts
- Joined: Aug. 2014
- Offline
-
- Navjit Gill
- Member
- 3 posts
- Joined: Aug. 2014
- Offline
-
- neil_math_comp
- Member
- 1743 posts
- Joined: March 2012
- Offline
setprimintrinsic can only be used to set writable intrinsic values specific to the particular primitive type of the primitive it's being used on. You can see a list of primitive intrinsics for a primitive in the Geometry Spreadsheet when viewing primitives, under the Intrinsics drop-down. Most aren't writable, since they're just computed based on information about the primitive, like measuredarea, but a few are writable.
I think the only writable one for the Circle primitive type is also “transform”. You can emulate the behaviour of the Orientation parameter on the Circle SOP by setting the transform intrinsic on a Circle primitive, but Circle primitives don't support anything equivalent to the Arc Type parameter, which is why it's greyed out if the Circle SOP has “Primitive Type” set to “Primitive”. That's only supported for the Polygon, NURBS Curve, and Bezier Curve options. In VEX, you can create a set of points, create a polyline and vertices for it wired to the points, and move the points to the positions around a circle, though.
I think the only writable one for the Circle primitive type is also “transform”. You can emulate the behaviour of the Orientation parameter on the Circle SOP by setting the transform intrinsic on a Circle primitive, but Circle primitives don't support anything equivalent to the Arc Type parameter, which is why it's greyed out if the Circle SOP has “Primitive Type” set to “Primitive”. That's only supported for the Polygon, NURBS Curve, and Bezier Curve options. In VEX, you can create a set of points, create a polyline and vertices for it wired to the points, and move the points to the positions around a circle, though.
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
-
- Quick Links

