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 endUsage:
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...