Newer
Older
.. algorithm::
.. summary::
.. relatedalgorithms::
.. properties::
Description
-----------
Creates a shape object that defines the sample and sets the sample for
the given workspace. Shapes are defined using XML descriptions that can
be found :ref:`here <HowToDefineGeometricShape>`.
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Usage
-----
**Example - A Sphere**
.. testcode:: Sphere
ws = CreateSampleWorkspace("Histogram",BankPixelWidth=1)
shape_xml = '''<sphere id="some-sphere">
<centre x="0.0" y="0.0" z="0.0" />
<radius val="1.0" />
</sphere>'''
CreateSampleShape(ws,shape_xml)
**Example - A ball with a cylinder carved out of the middle**
.. testcode:: BallwithHole
ws = CreateSampleWorkspace("Histogram",BankPixelWidth=1)
shape_xml = '''<cylinder id="stick">
<centre-of-bottom-base x="-0.5" y="0.0" z="0.0" />
<axis x="1.0" y="0.0" z="0.0" />
<radius val="0.05" />
<height val="1.0" />
</cylinder>
<sphere id="some-sphere">
<centre x="0.0" y="0.0" z="0.0" />
<radius val="0.5" />
</sphere>
<algebra val="some-sphere (# stick)" />'''
CreateSampleShape(ws,shape_xml)
.. categories::
.. sourcelink::