This question already has an answer here:

I would like to know if it is possible to define a Plot a Plot3D or any other Plot command as a graphic primitive.

For instance, I have defined a torus, and I would like to use it as a Graphics3D[] primitive with a command like



torus = First[
   ParametricPlot3D[{(4 + Cos[2 \[Pi] v]) Sin[
       2 \[Pi] u], (4 + Cos[2 \[Pi] v]) Cos[2 \[Pi] u], 
     Sin[2 \[Pi] v]}, {u, 0, 1}, {v, 0, 1}, Boxed -> False, 
    Axes -> False, MeshFunctions -> {#3 &}, Mesh -> 0, 
    ColorFunction -> "BrownCyanTones"]];

{x, y, z} being the position of my command.

I ask this because it is elementary to do that with Latex PsTricks and I would appreciate to do this directly inside Mathematica ( if it is possible it would simplify a lot some drawings).


marked as duplicate by Szabolcs, C. E., xzczd, xslittlegrass, happy fish Apr 10 '17 at 15:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    $\begingroup$ Yes, but don't do it unless you know that a function that evaluates to whatever you want (instead of staying unevaluated like a primitive) is not a better solution. The usual way is to just create a function that returns a list of graphics primitives that represent the graphics object you need. $\endgroup$ – Szabolcs Apr 10 '17 at 14:35
  • $\begingroup$ Related: mathematica.stackexchange.com/q/111403/1871 $\endgroup$ – xzczd Apr 10 '17 at 15:08
  • $\begingroup$ Thanks for signaling that my question is a duplicate, but I stay a dummy in front of Mathematica complexity --- whith pstricks things are simpler. But I want to master mathematica could some one explain simply how to creat in my case a createPrimitive3D $\endgroup$ – cyrille.piatecki Apr 10 '17 at 16:07

Browse other questions tagged or ask your own question.