How about the wait cursor, is there a way to display that?
Latest posts made by timc
-
RE: Use Sketchup default cursors
-
RE: Determine zoom level through API
Thank you thomthom, that is exactly what I was looking for.
-
RE: Determine zoom level through API
This is the code I'm using
#This is what I have in the draw method of my tool def draw(view) #@temp = the current mouse location. it is set in the mousemove method. @normal = view.camera.direction @pts_circle = circle_points(@temp.position, @normal, 10, 24) view.drawing_color = "blue" view.draw_polyline(@pts_circle) end #This is a function I found that creates the points needed to draw a circle def circle_points(center, normal, radius, numseg) # Get the x and y axes axes = Geom;;Vector3d.new(normal).axes xaxis = axes[0] yaxis = axes[1] zaxis = axes[2] xaxis.length = radius yaxis.length = radius # compute the points da = (Math;;PI * 2) / numseg pts = [] for i in 0..numseg do angle = i * da cosa = Math.cos(angle) sina = Math.sin(angle) vec = Geom;;Vector3d.linear_combination(cosa, xaxis, sina, yaxis) pts.push(center + vec) end # close the circle pts.push(pts[0].clone) pts end
If I use the mouse wheel to zoom while the tool is active the circle stays at a diameter of 10, so it appears larger if I zoom in and smaller if I zoom out.
-
Determine zoom level through API
Is there a way to determine the zoom level through the Sketchup API?
I am trying to emulate the way the circle drawing tool displays a circle around the current mouse position. I can display a circle with ease, but the circle gets larger as I zoom in. I want the circle to remain the same size despite how far I zoom in or out.
Any help would be appreciated, Thanks.
-
Use Sketchup default cursors
I was playing around with a new tool, and was wondering if there is an easy way to use Sketchup cursors, or do I have to use custom cursors?
For example I want to use the pencil cursor in my own tool. Are there constants setup that I can pass to UI.set_cursor()?
-
RE: Problem outputting arc to dxf file
I could change it so it recalculates the end_angle as well, that way I would not have to worry what SketchUp says the angle is. But I think I have bigger issues than that.
-
Problem outputting arc to dxf file
I have written a script that outputs simple 2D drawings to a dxf file, but I am having some trouble with arcs. Sometimes they output fine, other times they are either facing the wrong way or in the wrong location.
This is the code I'm using to output arcs. The start_angle of ArcCurves was always 0.0 so I created the get_new_angle function to calculate the angle of a line from the center of the arc to the start point, I use that as the start_angle and add it to end_angle.
Any help with this would be appreciated, Thanks
def dxf_output_arc(curve, layername) #curve is an ArcCurve object #layername is the name of the layer the object is on points = curve.center new_angle = get_new_angle(points, curve.vertices[0].position) $dxf_file.puts( " 0\nARC\n8\n"+layername+"\n") $dxf_file.puts(10.to_s+"\n"+(points.x.to_f * $conversion_factor).to_s)#x $dxf_file.puts(20.to_s+"\n"+(points.y.to_f * $conversion_factor).to_s)#y $dxf_file.puts(30.to_s+"\n"+(points.z.to_f * $conversion_factor).to_s)#z $dxf_file.puts(40.to_s+"\n"+(curve.radius.to_f * $conversion_factor).to_s)#radius $dxf_file.puts(50.to_s+"\n"+new_angle.to_f.to_s)#start_angle $dxf_file.puts(51.to_s+"\n"+((curve.end_angle.degrees + new_angle).to_f).to_s)#end_angle end def get_new_angle(center, point) #This function returns the angle of a line return Math;;atan(((center.y.to_f - point.y.to_f)/(center.x.to_f - point.x.to_f))).to_f.degrees.abs end
-
RE: Create faces in script
find_faces was exactly what I was looking for. Thanks,
-
Create faces in script
I am working on a script that creates 3D objects, but faces are not being created when edges intersect. What do I have to do to get faces to be created automatically?
-
Where is the best place to get help?
I often find myself writing ruby scripts to expand the functionality of SketchUp, but as I am not familiar with Ruby or the SketchUp API it is often difficult.
I have posted a few times to this forum, but have not really found much help. Where is the best place to get help writing scripts/tools for SketchUp?
I use this site a lot for API help http://code.google.com/apis/sketchup/docs/index.html