Hi all, I was able to get it to work in 3.14 by doing:
PlotOverLine1.UpdatePipeline() before creating the writer. Thanks, Tony > Date: Fri, 11 May 2012 09:18:29 -0400 > Subject: Re: [Paraview] VTK Writer > From: utkarsh.ayac...@kitware.com > To: mmn...@gmail.com > CC: lamtmar...@hotmail.com; paraview@paraview.org > > There definitely seems to be a bug in the WriterFactory which fails to > return valid readers when running through Python. We are looking into > it. > > Utkarsh > > On Thu, May 10, 2012 at 10:38 PM, Mohamad M. Nasr-Azadani > <mmn...@gmail.com> wrote: > > Luis, > > > > I had similar problem with some writers. > > It was very strange and sporadic (it occurred both when I used *.vtu and > > *.csv writers). > > I kind of got the feeling that most of the times it appeared when I ran PV > > in parallel so I could solve it by running PV in serial mode. > > But as I said, I am not 100% what is going on. > > > > Good luck, > > Mohamad > > > > On Sun, May 6, 2012 at 11:44 AM, Luis Martinez <lamtmar...@hotmail.com> > > wrote: > >> > >> Hi all, > >> > >> I have a pvbatch script that worked in version 3.12. It uses plot over > >> line and writes out CSV data. Now I get the following error in version > >> 3.14: > >> > >> Is this a bug or am I supposed to call the writer differently in 3.14? > >> > >> Thanks! > >> > >> Tony > >> > >> > >> > >> ERROR: In > >> /build/buildd/paraview-3.14.1/ParaViewCore/ServerManager/vtkSMWriterFactory.cxx, > >> line 374 > >> vtkSMWriterFactory (0x17ee360): No matching writer found for extension: > >> csv > >> > >> Traceback (most recent call last): > >> File "wakeProfilesAllTurbines.py", line 65, in <module> > >> writer.FieldAssociation = "Points" > >> AttributeError: 'NoneType' object has no attribute 'FieldAssociation' > >> > >> > >> > >> > >> Here is the script Im using: > >> > >> > >> > >> try: paraview.simple > >> except: from paraview.simple import * > >> paraview.simple._DisableFirstRenderCameraReset() > >> import os > >> import math > >> import matplotlib as mpl > >> mpl.use('Agg') > >> import matplotlib.pyplot as plt > >> import csv > >> from scipy.integrate import trapz > >> # Current location > >> directory=os.getcwd() > >> if not os.path.exists('./wakeProfiles/plots/'): > >> os.makedirs('./wakeProfiles/plots/') > >> # Rotor Diameter > >> D=93 > >> width=D*1.5 > >> profiles=[0.125,0.25,0.5,0.75,1,2,3,4] > >> layout=open('./layout.dat') > >> Umean_slice_0_vtk = LegacyVTKReader( > >> FileNames=[directory+'/../ADM/sliceDataADM/12746.8908019/Umean_slice_0.vtk'] > >> ) > >> Umean_slice_1_vtk = LegacyVTKReader( > >> FileNames=[directory+'/../ALM/sliceDataALM/12771/Umean_slice_0.vtk'] ) > >> SetActiveSource(Umean_slice_0_vtk) > >> CellDatatoPointData1 = CellDatatoPointData() > >> SetActiveSource(CellDatatoPointData1) > >> Calculator1 = Calculator() > >> Calculator1.AttributeMode = 'point_data' > >> Calculator1.Function = 'Umean_X*cos(0.84444265) + Umean_Y*sin(0.84444265)' > >> Calculator1.ResultArrayName = 'U_row' > >> SetActiveSource(Umean_slice_1_vtk) > >> CellDatatoPointData2 = CellDatatoPointData() > >> SetActiveSource(CellDatatoPointData2) > >> Calculator2 = Calculator() > >> Calculator2.AttributeMode = 'point_data' > >> Calculator2.Function = 'Umean_X*cos(0.84444265) + Umean_Y*sin(0.84444265)' > >> Calculator2.ResultArrayName = 'U_row' > >> for i, turbine in enumerate(layout): > >> for profile in profiles: > >> SetActiveSource(Calculator1) > >> PlotOverLine1 = PlotOverLine( Source="High Resolution Line Source" > >> ) > >> PlotOverLine1.Source.Resolution = 100 > >> alpha0=0.84444265-math.atan((width/2)/(profile*D)) > >> alpha1=0.84444265+math.atan((width/2)/(profile*D)) > >> L=math.sqrt((D*profile)**2+(width/2)**2) > >> x0=float(turbine.split()[0])+L*math.cos(alpha0) > >> y0=float(turbine.split()[1])+L*math.sin(alpha0) > >> x1=float(turbine.split()[0])+L*math.cos(alpha1) > >> y1=float(turbine.split()[1])+L*math.sin(alpha1) > >> PlotOverLine1.Source.Point1 = [x0, y0, 65.0] > >> PlotOverLine1.Source.Point2 = [x1, y1, 65.0] > >> if not os.path.exists('./wakeProfiles/'+str(profile)): > >> os.makedirs('./wakeProfiles/'+str(profile)) > >> if not os.path.exists('./wakeProfiles/plots/'+str(profile)): > >> os.makedirs('./wakeProfiles/plots/'+str(profile)) > >> > >> nameADM=directory+'/wakeProfiles/'+str(profile)+'/ADM'+'turbine'+str(i+1)+'.csv' > >> writer = CreateWriter(nameADM, PlotOverLine1) > >> writer.FieldAssociation = "Points" > >> writer.UpdatePipeline() > >> del writer > >> SetActiveSource(Calculator2) > >> PlotOverLine2 = PlotOverLine( Source="High Resolution Line Source" > >> ) > >> PlotOverLine2.Source.Resolution = 100 > >> PlotOverLine2.Source.Point1 = [x0, y0, 65.0] > >> PlotOverLine2.Source.Point2 = [x1, y1, 65.0] > >> > >> nameALM=directory+'/wakeProfiles/'+str(profile)+'/ALM'+'turbine'+str(i+1)+'.csv' > >> writer = CreateWriter(nameALM, PlotOverLine2) > >> writer.FieldAssociation = "Points" > >> writer.UpdatePipeline() > >> del writer > >> csvreader1 = csv.reader(open(nameADM,'rb')) > >> csvreader2 = csv.reader(open(nameALM,'rb')) > >> x,y,x1,y1=[],[],[],[] > >> for j, line in enumerate(csvreader1): > >> if j>0: > >> x.append((float(line[5])-width/2)/D) > >> y.append(float(line[0])) > >> for j, line in enumerate(csvreader2): > >> if j>0: > >> x1.append((float(line[5])-width/2)/D) > >> y1.append(float(line[0])) > >> plt.plot(x,y,'-',label='ADM',color='black') > >> plt.plot(x1,y1,'--',label='ALM',color='black') > >> plt.xlabel('Distance') > >> plt.ylabel(r'$U$ (m/s)') > >> plt.legend(loc='best') > >> plt.ylim([2,10]) > >> > >> plt.savefig('./wakeProfiles/plots/'+str(profile)+'/turbine'+str(i+1)+'.eps') > >> > >> plt.savefig('./wakeProfiles/plots/'+str(profile)+'/turbine'+str(i+1)+'.png') > >> plt.clf() > >> del x,y,x1,y1,csvreader1,csvreader2 > >> > >> > >> > >> > >> _______________________________________________ > >> Powered by www.kitware.com > >> > >> Visit other Kitware open-source projects at > >> http://www.kitware.com/opensource/opensource.html > >> > >> Please keep messages on-topic and check the ParaView Wiki at: > >> http://paraview.org/Wiki/ParaView > >> > >> Follow this link to subscribe/unsubscribe: > >> http://www.paraview.org/mailman/listinfo/paraview > >> > > > > > > _______________________________________________ > > Powered by www.kitware.com > > > > Visit other Kitware open-source projects at > > http://www.kitware.com/opensource/opensource.html > > > > Please keep messages on-topic and check the ParaView Wiki at: > > http://paraview.org/Wiki/ParaView > > > > Follow this link to subscribe/unsubscribe: > > http://www.paraview.org/mailman/listinfo/paraview > >
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview