2
$\begingroup$
par = Parallelepiped[{-250, 400,400}, {{0, 0, 0}, {0, -500, 0}, {7050, 0, 2763}}];
hex = Hexahedron[{{-250., 400., 400.}, {-250., 400., 400.}, {-250.,900., 400.}, {-250., 900., 400.}, {6800., 400., 3164.}, {6800., 400., 3164.}, {6800., 900., 3164.}, {6800., 900., 3164.}}];

grapar=Graphics3D[par];
DiscretizeGraphics[grapar, MaxCellMeasure -> 0.3]

(*I don't know why the DiscretizeGraphics don't work. From the wolfram reference website, Parallelepiped and Hexahedron belong to "Bounded piecewise linear primitives in Graphics3D (these can be represented exactly)" The error shows: DiscretizeGraphics::invprim: The graphics primitive Parallelepiped[{-250.,400.,400.},{{1.10^-17,-4.5474710^-13,1.*10^-17},{1.*10^-17,-500.,1.10^-17},{7050.,-5.6843410^-13,2763.}}] is not valid.

If anyone can help, I will really appreciate~ I would like to export it into stl. at the end, so I think this discretize step is necessary. Thank you!

*)

$\endgroup$

1 Answer 1

2
$\begingroup$

We can directly use Polygon.

p = {-250, 400, 400};
v1 = {0, -500, 0};
v2 = {7050, 0, 2763};
reg = Polygon[{p, p + v1, p + v1 + v2, p + v2}];
dreg = DiscretizeRegion[reg]
Export["test.stl", dreg]
Import["test.stl"]

enter image description here

If we change the order of the points of hex, Polygon also work.

pts = {{-250., 400., 400.}, {-250., 400., 400.}, {-250., 900., 
    400.}, {-250., 900., 400.}, {6800., 900., 3164.}, {6800., 900., 
    3164.}, {6800., 400., 3164.}, {6800., 400., 3164.}};
Export["test.stl", Polygon[pts]]
Import["test.stl"]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.