Hi there,
I am very interested in using openSCAD to create geometries to simulate the
passage of charged particles through said geometries.
To do this I have to export the openSCAD file format to something called the
Geometry Description Markup Language (GDML) format. The latter is a file
format used in software produced by CERN (Geant4).
I would also like to add more shape primitives to the current set to make it
more compatible with the expected shape primitives in Geant4
What facility is there to achieve this in openSCAD e.g. documentation or
example code.
I am a newbie programmer but I am keen to give it a go myself but need a bit
of initial guidance.
Thanks in advance!
--
View this message in context: http://forum.openscad.org/Export-to-GDML-and-additional-primitives-tp19911.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
You can create more shape "primatives" by just making modules.
Modules are akin to "objects" without attributes.
a simple example:
so to create a cube with a cylinder on top "primative":
module obj1(cubedim=[5,5,5], cylradius=3, cylheight=10) {
cube(cubedim, center=true);
translate([0,0,cubedim[2]]) cylinder(r=cylradius, h=cylheight,
center=true);
}
obj1();
--
Extra Ham Operator: K7AZJ
Registered Linux User: 275424
Raspberry Pi and Openscad developer
The most exciting phrase to hear in science - the one that heralds new
discoveries - is not "Eureka!" but "That's funny...".- Isaac. Asimov
On Wed, Jan 4, 2017 at 4:09 AM, rdarnley rdarnley@hotmail.co.uk wrote:
Hi there,
I am very interested in using openSCAD to create geometries to simulate the
passage of charged particles through said geometries.
To do this I have to export the openSCAD file format to something called
the
Geometry Description Markup Language (GDML) format. The latter is a file
format used in software produced by CERN (Geant4).
I would also like to add more shape primitives to the current set to make
it
more compatible with the expected shape primitives in Geant4
What facility is there to achieve this in openSCAD e.g. documentation or
example code.
I am a newbie programmer but I am keen to give it a go myself but need a
bit
of initial guidance.
Thanks in advance!
--
View this message in context: http://forum.openscad.org/
Export-to-GDML-and-additional-primitives-tp19911.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
with reference to this file format example
http://gdml.web.cern.ch/GDML/gdmlexample.html I don't see much
similarities.
Since GDML is somehow much richer I'd always start from that side, and use
OpenSCAD just as (CSG translator and) viewer. However you can't use modules
then unless you can introduce new primitives into GDML. But let me sketch
it:
This means, you could try to write a GDML->SCAD (or GDML-> CSG
https://de.wikipedia.org/wiki/Constructive_Solid_Geometry ) converter
tool thats writes/compiles any changes done in GDML into a OpenSCAD input
file. After loading this file into OpenSCAD, OpenSCAD can automatically
refresh the view port if it notices changes. To activate this feature
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_an_external_Editor_with_OpenSCAD
, just ceck the option "Design/Automatic reload and compile"
Your tool will have to parse the GDML file as far as the geometry of solids
is concerned and translate it into OpenSCAD code either as scad (which is
easier) or csg (which is normalized).
The other way round is more complicated, as you may have to automatically
insert your solid description into a given and presumably much richer GDML
file. I'd use a XML parser/writer library for that, which is available for
any serious programming language. Further I'd preferably implement a
CSG->GDML converter, since native SCAD language is to rich to be parsed.
Provided you have such a converter, you can use OpenSCAD without any
restrictions to define your geometry. After you are done you save the design
as CSG and convert it to GDML.
Nothing out of the box, but I guess you didn't expect more.
--
View this message in context: http://forum.openscad.org/Export-to-GDML-and-additional-primitives-tp19911p19914.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
To do this I have to export the openSCAD file format
to something called the Geometry Description Markup
Language (GDML) format. The latter is a file format
used in software produced by CERN (Geant4).
Just looking at the GDML example it might be possible
to export a limited model (e.g. without using minkowski
and other not supported operations or resolving those
to polyhedrons).
This would be another use case that could use meta
data attached to modules to help the export generate
a better structured file. But we don't have that yet.
I would also like to add more shape primitives to
the current set to make it more compatible with the
expected shape primitives in Geant4
I don't think we want special core support for all
the primitives supported by any export format. Using
meta data it might be possible to map composite
OpenSCAD parts (e.g. modules from a special GDML
library) to the GDML primitives at export time.
Just brainstorming... that could be something like
@GDMLPrimitive(type = "Cone", radius1 = r1, radius2 = r2, height = h)
module cone(r1, r2, h) {
cylinder(r1 = r1, r2 = r2, h = h);
}
What facility is there to achieve this in openSCAD
e.g. documentation or example code.
There's some general overview of the processing flow
in the github repo, but there's no such thing as
full code documentation (and that's totally unlikely
to ever happen).
The best strategy is probably to just follow the code
that exports the CSG files, as that's probably the
best match to GDML. Pretty much all the other export
formats use the final rendered mesh which will be of
no use for the GDML use case.
I am a newbie programmer but I am keen to give it
a go myself but need a bit of initial guidance.
We could discuss this in more detail on IRC (channel
#openscad on freenode, my nick is teepee). It might
be a bit of an adventure as there are probably some
more stepping stones missing to get a nice export,
but if we get that ground work done, this might open
up lots of other options like IGES and STEP export
too.
(In case you did not use IRC before, just use the link
from the github main page, readme below the file list).
ciao,
Torsten.