Re-orienting Coordinate system (Z-axis as ref)
-
It is easy enough to re-orient the coordinate system, but is there a way to choose the origin and then align the z-axis (blue) along a known line rather than the x-axis (red)? I could use a feature like this because I want to create an "off axis" cylinder (in the default coordinate space)pointing towards a known point, the base of which is a circle that must be normal to the central axis of the cylinder. The circle tool seems to orient to the XY plane by default, making it problematic to extrude in my intended direction and still remain cylindrical (as of now this direction is where the x-axis(red)is pointing).
The freerotate pugin is another option but is a big clunky. Any other ideas?
-
The 'Axes' tool resets the axes in RG[B] order so you need to have R & G pickable as Blue comes from those automatically. If you have a line drawn in the required-Blue direction it's simple enough to draw a line from it at right angles... start a new line pick on the line drawn in the required-Blue direction, hover the mouse over that line and the temp-guide drawn to the cursor will turn magenta as you move away from the line - the inferencing has locked to be parallel to that existing line, now move your cursor at approximately a right angle and when the temp-guide again turns magenta - showing it's perpendicular. At this point you can hold shift to lock the new edge to that line. Pick a point to add the edge.
To add a second line at right angles to the one you just added... select that new line, Rotate+Ctrl to copy it, drag the mouse [keep the button down] along the line drawn in the required-Blue direction, this will lock the rotation gizmo to that line as the axis, pick a point on the line you are copying and start the copy, type in 90. Now you have the line drawn in the required-Blue direction and two other lines drawn from it at right angles to it and each other. You can adjust the rotation of these two by selecting both [+Ctrl adds to a selection] and use the Rotate tool again drag-locked to the first line as its axis.
Now use the Axes tool snapping to each of these new lines in turn for R & G and Blue is automatically set to the line you want...
Erase the temp-lines when they are no longer needed.
It's much quicker to do the steps that it is to write them! -
@northcoastrat said:
It is easy enough to re-orient the coordinate system, but is there a way to choose the origin and then align the z-axis (blue) along a known line rather than the x-axis (red)? ......
This applies to any line in space and with basic SU tools.A given line.
Select 'Axes' tool to change axes, direct Red along that line by first two clicks. Click green anywhere. Green and Blue are now perpendicular to the line. Right click on one of the axes and select 'Move' in context menu.
Enter for rotation: X(red) 90 and Y(green) 90 [OK]. Change nothing else.
Now blue is along the given line -
If you can draw, or move your component to the desired origin, this will rotate the component's z axis on its origin to what ever you can point to.
-
Thinking about this a little more...
You can readily snap the new Axes to the desired line - using the first pick Red, and then pick Green anywhere, and Blue follows automatically.
A Circle's orientation will default to be on any of the three axial planes [or a non-axial surface that you might hover over].
If you are looking generally along the Red axis it will be oriented on that Plane [it shows Red]...
Now hold Shift to lock to that orientation and you can draw the circle square to the line at any picked point you want.
If it's awkward to position the circle's center exactly at that time, then if its made 'in space' you can then Select it and Move it by its center [inference again] to snap to exactly where you want it after it's been created.
Why worry about the circle/line having to be the Blue axial ? Just Orbit till Red becomes available and lock to that! The change of axes is only temporary and the actual axis that something is locked to is usually unimportant [unless you are inserting a component]... -
Hi folks.
Depending on how your view is orbited, you can draw a circle on the red/blue (XZ) plane as well as the green/blue (YZ) plane as easily as it is on the red/green (XY) plane.
You can also rotate the cylinder to any orientation with the Rotate Tool.
Just ideas.
-
Thanks for all the input, I just returned from three weeks of field work and will give these ideas a try. I am also interested in creating/working with someone on a script that will take my data in the format below and create a series of cone frusta automatically. I have very limited experience with programming however. The data below is an example of two conic frusta oriented in x,y,z, space.
Data Format: Base Top
X Y Z Diam X Y Z Diam
0 0 0 6.5 4 6 10 6.0
4 6 10 5.9 10 12 15 5.0 -
@honoluludesktop said:
If you can draw, or move your component to the desired origin, this will rotate the component's z axis on its origin to what ever you can point to.
I'm having trouble making this work. How do you know where the component's origin is? It doesn't seem to point my shape along the necessary line, but always at a strange angle to it.
-
It's relatively easy to read a file and make some geometry.
Do you want a solid object or just two circles, perhaps with joining lines or clines ??
Is the data 'space' separated1 2 3 44 5 6 7 88
where its 1st x y z diam and then 2nd x y z diam - on one line er 'cone'?
How many 'segments' would you like? 6, 8, 12, 24, 36 ?
I'll try to post some code for you shortly...
To find a group/instance's location usepoint=group.transformation.origin
to get its insertion point, to set its insertion point usegroup.transform!(Geom::Transformation.new(point))
-
Copy+paste this code into a file named something like
data2frusta.rb
in the Plugins foldermodule TIG def self.data2frusta() model=Sketchup.active_model ents=model.active_entities path=model.path if path=='' folder=Dir.pwd else folder=File.dirname(path) end file=UI.openpanel("Chose DATA txt file", folder, "*") return nil if not file or not File.exist?(file) model.start_operation("data2frusta") ns=24 ### number of segments name="frusta#1" ### group name lines=IO.readlines(file) lines.each{|line| line.chomp! next if line=='' next if not line=~/[0-9]/ data=line.split(' ') p0=Geom;;Point3d.new(data[0].to_f, data[1].to_f, data[2].to_f) r0=data[3].to_f/2.0 p1=Geom;;Point3d.new(data[4].to_f, data[5].to_f, data[6].to_f) r1=data[7].to_f/2.0 no=p0.vector_to(p1) group=ents.add_group() names=[];model.definitions.each{|d|names << d.name if d.group?} name.next! while names.include?(name) gents=group.entities group.name=name gents.parent.name=name c0=gents.add_circle(p0,no,r0,ns) c1=gents.add_circle(p1,no,r1,ns) c0[0].find_faces f0=c0[0].faces[0] c1[0].find_faces f1=c1[0].faces[0] v0s=f0.vertices v1s=f1.vertices 0.upto(ns-1){|i| li=gents.add_line(v0s[i],v1s[i]) li.find_faces li.smooth=true li.soft=true } f0.reverse! } model.commit_operation end end
Usage:
In the Ruby Console typeTIG.data2frusta
- select the data.txt file that is in the format for each line of
x0 y0 z0 d0 x1 y1 z1 d1
where the conic-start 0 center is at [x0,y0,z0] and has the diameter d0
and the conic-end 1 center is at [x1,y1,z1] and has the diameter d1.
Each line of code makes a grouped conic frusta - to change from 24 sides or another group-name edit the code at the ### noted lines...
It is one step undo-able, canceling at the file dialog stops the tool...
Advertisement