|
[Sponsors] |
July 24, 2018, 05:10 |
Selecting & Colouring Edges using Scheme
|
#1 |
New Member
Join Date: Jul 2018
Posts: 3
Rep Power: 8 |
EDIT: Apologies, I selected the wrong forum when posting, can this be moved please?
I'm trying to automate some of the visualization checks we perform before running a simulation. This includes colour-coding some edges and zones. However I'm having some issues finding/figuring out the functions to call. I'm new to scheme and fluent, so please understand I may be looking at the wrong areas. First Issue: setting edge colour. The only way I've found to set specific edge colours was to record the journal of the clicks to manually set it. However, this results in sometimes the colour not applying to the edge. Adding a (cx-pause) guarantees that it's applied, however this has an obvious fault. I would have figured the /display/update-scene/display function would be able to set edge colour, as this seems to be the function that emulates the form used to set colours, but it doesn't. Code:
(define (set_edge_color name_filter edge_r edge_g edge_b edge_t is_edge) (let () (if (not (and (equal? is_edge 1) is_edge)) (set! is_edge 0) (set! is_edge 1)) (ti-menu-load-string (format #f "/display/surface-mesh '(~a)" name_filter)) (ti-menu-load-string "/display/views/auto-scale") (cx-gui-do cx-activate-item "Ribbon*Frame1*Frame7(Viewing)*Table1*Table3(Graphics)*PushButton4(Compose)") (cx-gui-do cx-activate-item "Scene Description*Frame1*List1(Names)") (cx-gui-do cx-activate-item "Scene Description*PushButton2(fl_SelectAll)") (cx-gui-do cx-activate-item "Scene Description*Frame5(Geometry Attributes)*ButtonBox2*PushButton1(Display)") (cx-gui-do cx-set-list-selections "Display Properties*Frame3(Colors)*DropDownList1(Color)" '( 1)) (cx-gui-do cx-activate-item "Display Properties*Frame3(Colors)*DropDownList1(Color)") (display (format #f "Setting red to: ~a\n" edge_r)) (cx-gui-do cx-set-scale "Display Properties*Frame3(Colors)*Scale2(Red)" edge_r) (display (format #f "Setting green to: ~a\n" edge_g)) (cx-gui-do cx-set-scale "Display Properties*Frame3(Colors)*Scale3(Green)" edge_g) (display (format #f "Setting blue to: ~a\n" edge_b)) (cx-gui-do cx-set-scale "Display Properties*Frame3(Colors)*Scale4(Blue)" edge_b) (if (not (equal? is_edge 1)) (cx-gui-do cx-set-scale "Display Properties*Frame3(Colors)*Scale5(Transparency)" edge_t) ) ;STUPID HACK TO GET COLOR TO APPLY (if color_pause (cx-pause)) (cx-gui-do cx-activate-item "Display Properties*PanelButtons*PushButton1(OK)") (cx-gui-do cx-activate-item "Display Properties*PanelButtons*PushButton2(Cancel)") (cx-gui-do cx-activate-item "Scene Description*PanelButtons*PushButton1(OK)") (cx-gui-do cx-activate-item "Scene Description*PanelButtons*PushButton2(Cancel)") )) Code:
;display new zone (display (format #f "Displaying ~a~%" elem)) (ti-menu-load-string (format #f "/display/surface-mesh '(~a)~%" elem )) ;select it (display (format #f "Selecting ~a~%" elem)) (ti-menu-load-string (format #f "/display/update-scene/select-geometry ~a ~a ~a~%" "yes" elem "no")) ;color it (ti-menu-load-string (format #f "/display/update-scene/display ~a ~a ~a ~a ~a ~a ~a ~a ~a ~a ~a ~a ~a~%" "yes" "no" "yes" "no" "no" "no" "no" "no" "no" (list-ref zone_colors 0) (list-ref zone_colors 1) (list-ref zone_colors 2) (list-ref zone_colors 3) )) Any input/suggestions would be greatly appreciated! |
|
July 26, 2018, 04:18 |
|
#2 |
New Member
Join Date: Jul 2018
Posts: 3
Rep Power: 8 |
In the spirit of not abandoning a thread. I've figured out the solution to one of the issues. After inspecting several functions related to surfaces I finally found the following:
Code:
(cx-store-surface-desc-attr (cx-get-surface surface_id) edge-color|face-color (1 0 0 0)) The colors are percentages of 255 and in order r g b trans This can set edge or face color easily enough. Now to figure out how to display faces properly... |
|
July 26, 2018, 04:36 |
|
#3 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
what is ~% in your code? What is functionality of this expression?
Code:
(display (format #f "Displaying ~a~%" elem)) May be you should make a loop to go though the whole list and execute calling function each time? best regards |
|
July 26, 2018, 05:08 |
|
#4 |
New Member
Join Date: Jul 2018
Posts: 3
Rep Power: 8 |
~% just causes a new line to be appended to the displayed string.
|
|
Tags |
colouring, edges, faces, scheme, scheme programming |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[snappyHexMesh] SnappyHexMesh for internal Flow | vishwa | OpenFOAM Meshing & Mesh Conversion | 24 | June 27, 2016 09:54 |
[surface handling] SurfaceFeatureExtract Foam::error::printStack | donQi | OpenFOAM Meshing & Mesh Conversion | 1 | August 15, 2013 01:43 |
Tutorial for sprayEngineFoam | ed_teller | OpenFOAM Running, Solving & CFD | 4 | May 27, 2013 08:03 |
Problem? with Installation of OpenFOAM 2.1.0 on to Ubuntu 10.4.4 VirtualBox | Stubby | OpenFOAM Installation | 8 | March 5, 2012 16:12 |
[snappyHexMesh] external flow with snappyHexMesh | chelvistero | OpenFOAM Meshing & Mesh Conversion | 11 | January 15, 2010 20:43 |