0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

windows11で、sketchup6 その115

0
Last updated at Posted at 2026-11-21

概要

windows11に、sketchup6を入れてみた。
rubyで、3Dを書く。
AIに、聞いてみた。
「スポーツカーを、問いに答えると、生成する。」
自分は、一行も書いてない。

サンプルコード

r=UI.inputbox(["Car Height (mm)","Wheel Diameter (mm)","Total Length (mm)"],["1050","680","4400"],"2-Seater Sports Car"); if r; h,wd,l=r.map{|v| v.to_f.mm}; wr=wd/2.0; gc=120.mm; bh=gc+500.mm; m=Sketchup.active_model; m.start_operation("TwoSeater"); g=m.entities.add_group; e=g.entities; pts=[[0,-950.mm,gc],[l*0.95,-950.mm,gc],[l,-950.mm,gc+150.mm],[l*0.97,-950.mm,gc+320.mm],[l*0.72,-950.mm,bh],[l*0.03,-950.mm,bh+40.mm],[0,-950.mm,gc+400.mm]]; f=e.add_face(pts); f.pushpull(-1900.mm); wg1=e.add_group; wf1=wg1.entities.add_face([[l*0.68,-800.mm,bh],[l*0.58,-800.mm,h],[l*0.56,-800.mm,h],[l*0.66,-800.mm,bh]]); wf1.pushpull(-1600.mm); wg1.material="lightcyan"; [-420.mm,420.mm].each{|sy| sg=e.add_group; se=sg.entities; sf1=se.add_face([[l*0.32,sy-220.mm,bh],[l*0.52,sy-220.mm,bh],[l*0.52,sy+220.mm,bh],[l*0.32,sy+220.mm,bh]]); sf1.pushpull(120.mm); sf2=se.add_face([[l*0.30,sy-220.mm,bh],[l*0.36,sy-220.mm,bh],[l*0.32,sy-220.mm,h*0.92],[l*0.26,sy-220.mm,h*0.92]]); sf2.pushpull(-440.mm); sg.material="dimgray"; rg=e.add_group; rf=rg.entities.add_face(rg.entities.add_circle([l*0.25,sy,bh+180.mm],X_AXIS,150.mm,16)); rf.pushpull(30.mm); rg.material="silver"}; stg=e.add_group; stf=stg.entities.add_face(stg.entities.add_circle([l*0.55,-420.mm,bh+140.mm],X_AXIS,170.mm,18)); stf.pushpull(25.mm); stg.material="black"; e.find_all{|ed| ed.is_a?(Sketchup::Edge)}.each{|ed| ed.soft=true; ed.smooth=true}; g.material="red"; [[l*0.2,-980.mm,wr,-250.mm,-1],[l*0.8,-980.mm,wr,-250.mm,-1],[l*0.2,980.mm,wr,250.mm,1],[l*0.8,980.mm,wr,250.mm,1]].each{|x,y,rad,w,dir| tg=e.add_group; tf=tg.entities.add_face(tg.entities.add_circle([x,y,rad],Y_AXIS,rad,36)); tf.pushpull(w); tg.material="black"; whg=e.add_group; whf=whg.entities.add_face(whg.entities.add_circle([x,y+(dir*255.mm),rad],Y_AXIS,rad*0.62,24)); whf.pushpull(dir*10.mm); whg.material="silver"}; m.commit_operation; end

実行結果

image.png

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?