CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Native Meshers: snappyHexMesh and Others

GUI for surfaceFeatureExtract

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree5Likes
  • 5 Post By elvis

Reply
 
LinkBack Thread Tools Display Modes
Old   November 11, 2012, 10:34
Default GUI for surfaceFeatureExtract
  #1
Senior Member
 
Elvis
Join Date: Mar 2009
Location: Sindelfingen, Germany
Posts: 579
Blog Entries: 5
Rep Power: 13
elvis is on a distinguished road
Hi,

I am experimenting with a GUI (pyvtk) to get a feeling which "-includedAngle" would make sense.

PHP Code:
#!/usr/bin/env python
import vtk

def callback
(objevent):
    global 
featureedges
    sliValue 
obj.GetValue()
    
featureedges.SetFeatureAngle(mathslider.Round(sliValue))

reader vtk.vtkOBJReader()
#reader.SetFileName("/home/opencfd/pyscript/propellerTip.obj")
reader.SetFileName("/home/opencfd/pyscript/motorBike.obj")

#reader = vtk.vtkSTLReader()
#reader.SetFileName("/home/opencfd/pyscript/bullet.stl")
reader.Update()

mapper1 vtk.vtkPolyDataMapper()
mapper1.SetInputConnection(reader.GetOutputPort())#just visualizing without FeatureEdges stuff
actor1 vtk.vtkActor()
actor1.SetMapper(mapper1)
actor1.GetProperty().SetOpacity(0.1)# better slider

featureedges vtk.vtkFeatureEdges()
featureedges.SetInputConnection(reader.GetOutputPort())
#featureedges.SetFeatureAngle(130) ###slider (default is 30) 
featureedges.BoundaryEdgesOff()
featureedges.ManifoldEdgesOff()
featureedges.NonManifoldEdgesOff()

mapper vtk.vtkPolyDataMapper()
mapper.SetInputConnection(featureedges.GetOutputPort())
actor vtk.vtkActor()
actor.SetMapper(mapper)

ren vtk.vtkRenderer()
renWin vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
iren vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)

mathslider vtk.vtkMath()#mathslider.Round(sliderRep.GetValue())

#sliderRep
sliderRep vtk.vtkSliderRepresentation2D()
sliderRep.SetTitleText("FeatureAngle")
sliderRep.GetTitleProperty().SetColor(0,1,0)
sliderRep.GetTitleProperty().ShadowOff()
sliderRep.GetSliderProperty().SetColor(0,0,1)
sliderRep.GetTubeProperty().SetColor(1,0,0)
sliderRep.GetCapProperty().SetColor(1,1,.5)
sliderRep.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay() 
sliderRep.GetPoint1Coordinate().SetValue(0.20.1)
sliderRep.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay() 
sliderRep.GetPoint2Coordinate().SetValue(0.80.1)
sliderRep.SetLabelFormat("%4.0lf")
#sliderRep.SetMinimumValue(0.5)
sliderRep.SetMaximumValue(180)#155
sliderRep.SetValue(1)

#sliderWidget
sliderWidget vtk.vtkCenteredSliderWidget()
#sliderWidget = vtk.vtkSliderWidget()
sliderWidget.SetInteractor(iren)
sliderWidget.SetRepresentation(sliderRep#passt
#sliderWidget.KeyPressActivationOff() #
#sliderWidget.SetAnimationModeToAnimate()#ob das gut ist
sliderWidget.AddObserver("InteractionEvent"callback)
#sliderWidget.On()
#featureedges.SetFeatureAngle(sliderRep.GetValue())#mathslider.Round(sliderRep.GetValue())

ren.AddActor(actor)
ren.AddActor(actor1)
ren.SetBackground(.2.2.2)
renWin.SetSize(500500)
iren.Initialize()
renWin.Render()
sliderWidget.On()
iren.Start() 
you need "python-vtk" to get it run, hope someone finds it useful! I hoped "vtkSliderWidget()" would work for the script, unfortunatly only "vtkCenteredSliderWidget()" works partually
Attached Images
File Type: jpg snapshot1.jpg (24.3 KB, 126 views)
File Type: jpg snapshot2.jpg (29.2 KB, 117 views)
File Type: jpg snapshot3.jpg (19.0 KB, 102 views)
File Type: jpg snapshot4.jpg (36.3 KB, 113 views)
File Type: jpg snapshot5.jpg (29.9 KB, 104 views)
anothr_acc, caduqued, sail and 2 others like this.
elvis is online now   Reply With Quote

Old   November 29, 2012, 08:12
Default
  #2
New Member
 
Giampaolo Cetraro
Join Date: Oct 2012
Posts: 13
Rep Power: 4
misklach is on a distinguished road
Hi, I tried your script and it is very useful! Thank you very much for sharing!!
misklach is offline   Reply With Quote

Old   July 30, 2015, 11:24
Default
  #3
Member
 
ms
Join Date: Mar 2009
Location: West London
Posts: 44
Rep Power: 8
anothr_acc is on a distinguished road
Wow! This is great. Thanks!
anothr_acc is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Helyx-OS Open Source GUI for OpenFOAM eugene OpenFOAM Announcements from Other Sources 14 July 13, 2015 10:39
TUI Commands from GUI? Carlos FLUENT 6 May 22, 2013 18:05
User Defined GUI Frederik FLUENT 0 June 23, 2006 16:12
Command Line vs. GUI Menus Go FLUENT 0 June 8, 2005 16:05
GUI window settings cmv CD-adapco 0 February 7, 2005 07:22


All times are GMT -4. The time now is 08:10.