RE: [LDPartEditor] 0.8.18 Beta Released (Show selection in Text Editor / bugfix)
2016-07-19, 9:32 (This post was last modified: 2016-07-19, 9:33 by Willy Tschager.)
2016-07-19, 9:32 (This post was last modified: 2016-07-19, 9:33 by Willy Tschager.)
(2016-07-15, 10:40)Willy Tschager Wrote: PS. I'll come back for more CSG questions so bare with me.
I'm fixing:
30082.dat
I tried to use CSG to rebuild to cut sphere. Here is what I came up with, based on your tutorial on the wiki:
Code:
0 BFC CERTIFY CCW
0 // Set the quality and epsilon value (optional)
0 // SYNTAX 0 !LPE CSG_QUALITY [3 to 48]
0 !LPE CSG_QUALITY 16
0 // SYNTAX 0 !LPE CSG_EPSILON [>=.0001]
0 !LPE CSG_EPSILON .0001
0 // Define the shapes
0 // SYNTAX 0 !LPE [CSG SHAPE] [ID (can be any string without spaces)] [COLOUR] [MATRIX]
0 !LPE CSG_ELLIPSOID a 1 0 0 10 7 0 0 0 0 7 0 -7 0
0 !LPE CSG_CUBOID b 4 0 0 0 10 0 0 0 10 0 0 0 10
0 !LPE CSG_CYLINDER z 14 0 -7 13.5 2.5 0 0 0 14 0 0 0 2.5
0 !LPE CSG_CUBOID y 4 0 -4.5 16.5 2.5 0 0 0 2.5 0 0 0 3
0 !LPE CSG_CUBOID x 4 0 4.5 16.5 2.5 0 0 0 2.5 0 0 0 3
0 // Modify the shapes
0 // SYNTAX 0 !LPE [CSG FUNCTION] [origin ID] [origin ID2] [target ID3]
0 !LPE CSG_DIFFERENCE a b f
0 !LPE CSG_UNION x y w
0 !LPE CSG_UNION w z v
0 !LPE CSG_DIFFERENCE f v u
0 // Compile the output
0 // SYNTAX 0 !LPE CSG_COMPILE [ID]
0 // The COMPILE command displays the CSG volume on the screen
0 // Inlining the following line will generate triangles of the CSG volume
0 !LPE CSG_COMPILE u
I also inlined the compiled U but was not very happy with the output, so I guess there is room for improvement of my code. Any help and suggestion is welcomed.
w.
PS. It would help if you could offer a raw code like 0 !LPE CSG_CUBOID x c 0 0 0 1 0 0 0 1 0 0 0 1 from a drop-down box in the toolbars for the primitives and the operators so I don't have to check back with the wiki.
LEGO ergo sum