source: sans/Dev/trunk/NCNR_User_Procedures/Analysis/Models/Models_2D/GizmoCylinder_v40.ipf @ 570

Last change on this file since 570 was 570, checked in by srkline, 13 years ago

Change (1):
In preparation for release, updated pragma IgorVersion?=6.1 in all procedures

Change (2):
As a side benefit of requiring 6.1, we can use the MultiThread? keyword to thread any model function we like. The speed benefit is only noticeable on functions that require at least one integration and at least 100 points (resolution smearing is NOT threaded, too many threadSafe issues, too little benefit). I have chosen to use the MultiThread? only on the XOP assignment. In the Igor code there are too many functions that are not explicitly declared threadsafe, making for a mess.

File size: 3.7 KB
Line 
1#pragma rtGlobals=1             // Use modern global access method.
2#pragma IgorVersion=6.1
3
4Proc ShowCylinderOrientation()
5        Gizmo1()
6end
7
8Window Gizmo1() : GizmoPlot
9        PauseUpdate; Silent 1   // Building Gizmo 6 window...
10
11        // Do nothing if the Gizmo XOP is not available.
12        if(exists("NewGizmo")!=4)
13                DoAlert 0, "Gizmo XOP must be installed"
14                return
15        endif
16
17        NewGizmo/N=ObjOrient/T="Object Orientation" /K=1 /W=(653,158,1018,524)
18        ModifyGizmo startRecMacro
19        AppendToGizmo Axes=CustomAxis,name=axes0
20        ModifyGizmo ModifyObject=axes0,property={0,axisRange,0,0,-1,0,0,1}
21        ModifyGizmo ModifyObject=axes0,property={0,lineWidth,15}
22        ModifyGizmo ModifyObject=axes0,property={0,axisScalingMode,1}
23        ModifyGizmo ModifyObject=axes0,property={0,axisColor,0,0,0,1}
24        ModifyGizmo ModifyObject=axes0,property={0,axisMinValue,-1}
25        ModifyGizmo ModifyObject=axes0,property={0,axisMaxValue,1}
26        AppendToGizmo Axes=boxAxes,name=axes1
27        ModifyGizmo ModifyObject=axes1,property={-1,axisMode,1}
28        ModifyGizmo ModifyObject=axes1,property={0,gridType,1}
29        ModifyGizmo ModifyObject=axes1,property={0,gridPlaneColor,0.719997,0.719997,0.719997,1}
30        ModifyGizmo ModifyObject=axes1,property={-1,axisScalingMode,1}
31        ModifyGizmo ModifyObject=axes1,property={-1,axisColor,0,0,0,1}
32        AppendToGizmo attribute color={0,0.244,1,1},name=color0
33        AppendToGizmo attribute ambient={1,1,1,1,1032},name=ambient0
34        ModifyGizmo setDisplayList=0, object=axes0
35        ModifyGizmo setDisplayList=1, object=axes1
36        ModifyGizmo SETQUATERNION={-0.105935,0.419811,0.039369,0.900544}
37        ModifyGizmo autoscaling=1
38        ModifyGizmo currentGroupObject=""
39        ModifyGizmo compile
40
41        ModifyGizmo bringToFront
42        ModifyGizmo hookFunction=GizmoRotationHook
43        ModifyGizmo showAxisCue=1
44        ModifyGizmo endRecMacro
45End
46
47
48
49// angles are input in degrees
50Proc ChangeAngle(theta,phi)
51        Variable theta,phi
52        Prompt theta,"THETA in degrees"
53        Prompt phi, "PHI in degrees"
54       
55        Variable dx,dy,dz
56       
57        theta = theta/360*2*pi
58        phi = phi/360*2*pi
59       
60        Print "theta, phi in radians = ",theta,phi
61       
62        dx = sin(theta)*cos(phi)
63        dy = sin(theta)*sin(phi)
64        dz = cos(theta)
65       
66        Print "Unit vector dx,dy,dz = ",dx,dy,dz
67        ModifyGizmo/N=ObjOrient ModifyObject=axes0,property={0,axisRange,-dx,-dy,-dz,dx,dy,dz}
68end
69
70//Window Gizmo0() : GizmoPlot
71//      PauseUpdate; Silent 1   // Building Gizmo 6 window...
72//
73//      // Do nothing if the Gizmo XOP is not available.
74//      if(exists("NewGizmo")!=4)
75//              DoAlert 0, "Gizmo XOP must be installed"
76//              return
77//      endif
78//
79//      NewGizmo/N=Gizmo0/T="Gizmo0" /W=(679,232,937,496)
80//      ModifyGizmo startRecMacro
81//      AppendToGizmo Axes=boxAxes,name=axes0
82//      ModifyGizmo ModifyObject=axes0,property={-1,axisMode,1}
83//      ModifyGizmo ModifyObject=axes0,property={0,gridType,1}
84//      ModifyGizmo ModifyObject=axes0,property={0,gridPlaneColor,0.719997,0.719997,0.719997,1}
85//      ModifyGizmo ModifyObject=axes0,property={-1,axisScalingMode,1}
86//      ModifyGizmo ModifyObject=axes0,property={-1,axisColor,0,0,0,1}
87//      AppendToGizmo cylinder={0.05,0.05,1,10,10},name=cylinder0
88//      AppendToGizmo attribute color={0,0.244,1,1},name=color0
89//      AppendToGizmo attribute ambient={1,1,1,1,1032},name=ambient0
90//      ModifyGizmo setDisplayList=0, object=axes0
91//      ModifyGizmo setDisplayList=1, opName=rotate0, operation=rotate, data={10,1,0,0}
92//      ModifyGizmo setDisplayList=2, opName=rotate1, operation=rotate, data={45,0,1,0}
93//      ModifyGizmo setDisplayList=3, opName=translate0, operation=translate, data={0,0,-0.5}
94//      ModifyGizmo setDisplayList=4, attribute=color0
95//      ModifyGizmo setDisplayList=5, object=cylinder0
96//      ModifyGizmo SETQUATERNION={-0.135609,0.238706,0.084163,0.957887}
97//      ModifyGizmo autoscaling=1
98//      ModifyGizmo currentGroupObject=""
99//      ModifyGizmo compile
100//
101//      ModifyGizmo showInfo
102//      ModifyGizmo infoWindow={156,382,646,561}
103//      ModifyGizmo bringToFront
104//      ModifyGizmo hookFunction=GizmoRotationHook
105//      ModifyGizmo showAxisCue=1
106//      ModifyGizmo endRecMacro
107//End
Note: See TracBrowser for help on using the repository browser.