sketchucation logo sketchucation
    • Login
    1. Home
    2. northcoastrat
    3. Topics
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    N
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 4
    • Groups 1

    Topics

    • N

      Re-orienting Coordinate system (Z-axis as ref)

      Watching Ignoring Scheduled Pinned Locked Moved Newbie Forum sketchup
      10
      0 Votes
      10 Posts
      705 Views
      TIGT
      Copy+paste this code into a file named something like data2frusta.rb in the Plugins folder module 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 type TIG.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...
    • N

      Creating a Frustum of a Cone with absolute measurements.

      Watching Ignoring Scheduled Pinned Locked Moved Newbie Forum sketchup
      4
      0 Votes
      4 Posts
      2k Views
      Dave RD
      As to drawing the frustra in SketchUp, you could take advantage of Cardinal Points and the Move tool. You'd end up moving the points the desired change in radius. So if the radius is 1 inch and you want the new radius to be 3/4", move a cardinal point 1/4". Maybe you could utilize that in a script to do what you need.
    • 1 / 1