C#ATIA

↑タイトル詐欺 主にFusion360API 偶にCATIA V5 VBA(絶賛ネタ切れ中)

siren v0.13 NURBS曲線・Bスプライン曲線

こちらの続きです。

行き詰まり感たっぷりなのですが、ちょっと試してみたい事が
あったので引き続き挑戦。

こちらの何でもない3Dな曲線をCATIAで作成しIgesでエクスポート。(curve1.igs)
f:id:kandennti:20170727152855p:plain
続いてSirenスプリクトをこんな感じで作成します。

#
include Siren

fName = "/curve1"
$inPath = ARGV[0] + fName + ".igs"
$exPath = ARGV[0] + fName + "-res.igs"
$dpPath = ARGV[0] + fName + "_dump.txt"

def wDump(i)
  if i.kind_of?(String)
     open($dpPath, "a") {|f| f.write "\r\n" + i}
  end
end

wDump("start")
###########

shp = Siren.load_model $inPath
wDump(shp.to_s)
wDump(shp.nurbs_def.to_s)
Siren.save_model shp, $exPath

###########
wDump("end")
puts "done."

何をしているかと言いますと、CATIAで作成したIgesを
Sirenで読み込み、再度別名のIgesでエクスポートしているだけです。
但し、途中で読み込んだ曲線の次数やノットベクトル等の情報を
ダンプさせています。

ダンプさせた内容がこちら

start

#<Shape:0x27577e8 @type=EDGE>

[5, 

[0, 17.39738523, 28.8962564, 39.23864718, 50.07377854, 67.53908293], 

[6, 3, 3, 3, 3, 6], 

[#<Vec:0x27573a5 @x=10.000000, @y=-20.000000, @z=-10.000000>,
 #<Vec:0x2757395 @x=9.587310, @y=-19.663785, @z=-7.111170>,
 #<Vec:0x2757345 @x=9.066687, @y=-19.247257, @z=-4.318377>,
 #<Vec:0x2757335 @x=8.414916, @y=-18.739432, @z=-1.647258>,
 #<Vec:0x27572e5 @x=7.064933, @y=-17.728351, @z=2.468286>,
 #<Vec:0x27572d5 @x=5.183948, @y=-16.463305, @z=5.802195>,
 #<Vec:0x2757285 @x=4.342483, @y=-15.922227, @z=6.978457>,
 #<Vec:0x2757275 @x=2.558949, @y=-14.842477, @z=8.853440>,
 #<Vec:0x2757225 @x=0.445590, @y=-13.724272, @z=9.964573>,
 #<Vec:0x2757215 @x=-0.623246, @y=-13.198986, @z=10.301741>,
 #<Vec:0x27571c5 @x=-2.929444, @y=-12.162037, @z=10.599622>,
 #<Vec:0x27571b5 @x=-5.413111, @y=-11.251836, @z=10.141983>,
 #<Vec:0x2757165 @x=-6.714933, @y=-10.831739, @z=9.723114>,
 #<Vec:0x2757155 @x=-10.156001, @y=-9.869701, @z=8.217441>,
 #<Vec:0x2757105 @x=-13.650081, @y=-9.267638, @z=5.788367>,
 #<Vec:0x27570f5 @x=-15.795199, @y=-9.037527, @z=4.030341>,
 #<Vec:0x27570a5 @x=-17.911583, @y=-8.933958, @z=2.088417>,
 #<Vec:0x2757095 @x=-20.000000, @y=-8.944927, @z=0.000000>],

[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],

0, 

67.53908293]

end

恐らく、(僕を含めて)何の事だか判らないだろうと思います。

開発者の方のこちらを参考に見てみると
OpenCASCADE で NURBS 曲線を作成する – dyama's page
ん~ 引数multsの説明がされていました。

ダンプさせた際の
[0, 17.39738523,・・・
が、multsに該当するのかと思ったのですが、説明書きとは違います。
OpenCascadeと引数の順番が違うのも、ちょっと気になるのですが・・・。

イロイロやっているのですが、上手く行かないなぁ。