0

私は洞察のケースを読んでいます。

特定のスライスについて、次のプロットオーバーライン関数を使用して2点間をプロットしています:

def plotoverline(Xa,Ya,Xb,Yb,Za,Zb,case,index):

    PlotOverLine1 = PlotOverLine( Source = "High Resolution Line Source" )

    PlotOverLine1.Source.Point1 = [Xa, Ya, Za]
    PlotOverLine1.Source.Point2 = [Xb, Yb, Zb]

    PlotOverLine1.Source.Resolution = nb_pts

    # saving data in CSV File
    filename = "case_" + str(case) + "_"  + str(index) + ".csv"
    writer = CreateWriter(filename)
    writer.FieldAssociation = "Points" # or "Cells"
    writer.UpdatePipeline() 

return filename

複数の行をプロットし、すべての行のデータをcsvファイルにエクスポートしたいのですが、コードは最初の行のデータと他の行の「nan」のみを書き込みます。

Z = 200 # attitude of my slice
for i in range(le):
    Xb = left[i,0]
    Yb = left[i,1]
    Xa = pt[i,0] 
    Ya = pt[i,1] 
    data = plotoverline(Xa,Ya,Xb,Yb,Z,Z,case,ind_left[i])
4

1 に答える 1

0

作業中のスライスを指定するだけで済みました。plotoverline 関数は次のようになります。

def plotoverline(Slice, Xa,Ya,Xb,Yb,Za,Zb,case,index):

    SetActiveSource(Slice)
    PlotOverLine1 = PlotOverLine( Source = "High Resolution Line Source" )

    PlotOverLine1.Source.Point1 = [Xa, Ya, Za]
    PlotOverLine1.Source.Point2 = [Xb, Yb, Zb]

    PlotOverLine1.Source.Resolution = nb_pts

    # saving data in CSV File
    filename = "case_" + str(case) + "_"  + str(index) + ".csv"
    writer = CreateWriter(filename)
    writer.FieldAssociation = "Points" # or "Cells"
    writer.UpdatePipeline() 

return filename
于 2014-08-11T12:14:24.477 に答える