CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[surface handling] GUI for surfaceFeatureExtract

Register Blogs Community New Posts Updated Threads Search

Like Tree6Likes
  • 6 Post By elvis

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 11, 2012, 10:34
Default GUI for surfaceFeatureExtract
  #1
Senior Member
 
Elvis
Join Date: Mar 2009
Location: Sindelfingen, Germany
Posts: 620
Blog Entries: 6
Rep Power: 24
elvis will become famous soon enough
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, 328 views)
File Type: jpg snapshot2.jpg (29.2 KB, 302 views)
File Type: jpg snapshot3.jpg (19.0 KB, 263 views)
File Type: jpg snapshot4.jpg (36.3 KB, 285 views)
File Type: jpg snapshot5.jpg (29.9 KB, 267 views)
anothr_acc, caduqued, sail and 3 others like this.
elvis is offline   Reply With Quote

Old   November 29, 2012, 08:12
Default
  #2
New Member
 
Giampaolo Cetraro
Join Date: Oct 2012
Posts: 14
Rep Power: 14
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, 12:24
Default
  #3
Member
 
ms
Join Date: Mar 2009
Location: West London
Posts: 48
Rep Power: 17
anothr_acc is on a distinguished road
Wow! This is great. Thanks!
anothr_acc is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SnappyHexMesh GUI add-on for Blender tkeskita OpenFOAM Pre-Processing 22 April 22, 2024 12:45
Helyx-OS Open Source GUI for OpenFOAM eugene OpenFOAM Announcements from Other Sources 31 March 9, 2020 17:55
[Discussion]Should we create a GUI interface to OF utilities?[With Working prototype] chriss85 OpenFOAM 1 October 21, 2016 06:48
Command Line vs. GUI Menus Go FLUENT 0 June 8, 2005 17:05
GUI window settings cmv Siemens 0 February 7, 2005 07:22


All times are GMT -4. The time now is 23:22.