-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1512e92
commit d9a2d21
Showing
3 changed files
with
104 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,40 @@ | ||
module edit_plot_examples | ||
using FinEtools | ||
using FinEtoolsFlexStructures.FESetCorotBeamModule: FESetL2CorotBeam | ||
using FinEtoolsFlexStructures.FESetL2BeamModule: FESetL2Beam | ||
using FinEtoolsFlexStructures.CrossSectionModule: CrossSectionCircle, CrossSectionRectangle | ||
using FinEtoolsFlexStructures.MeshFrameMemberModule: frame_member, merge_members | ||
using VisualStructures: plot_nodes, plot_midline, render, plot_space_box, plot_solid, space_aspectratio, default_layout_3d, plot_from_json | ||
using PlotlyJS | ||
using JSON | ||
|
||
L = 42 | ||
xyz = [0 0 0; | ||
0 L/4 L*1/4; | ||
L/4 L/4 L*2/4; | ||
L/4 0 L*3/4; | ||
0 0 L] | ||
nL = 20 | ||
function allrun() | ||
|
||
cs = CrossSectionCircle(s -> 5.9910, s -> [0.0, 0.0, 1.0]) | ||
fens, fes = frame_member(xyz, nL, cs) | ||
plots = cat(plot_nodes(fens), | ||
plot_midline(fens, fes; color = "rgb(155, 155, 255)", lwidth = 4), | ||
dims = 1) | ||
layout = default_layout_3d(autosize=true) | ||
L = 42 | ||
xyz = [0 0 0; | ||
0 L/4 L*1/4; | ||
L/4 L/4 L*2/4; | ||
L/4 0 L*3/4; | ||
0 0 L] | ||
nL = 20 | ||
|
||
cs = CrossSectionCircle(s -> 5.9910, s -> [0.0, 0.0, 1.0]) | ||
fens, fes = frame_member(xyz, nL, cs) | ||
plots = cat(plot_nodes(fens), | ||
plot_midline(fens, fes; color = "rgb(155, 155, 255)", lwidth = 4), | ||
dims = 1) | ||
layout = default_layout_3d(autosize=true) | ||
# layout = default_layout_3d(width=400, height=400) | ||
layout[:showLegend] = true | ||
layout[:showLegend] = true | ||
|
||
config = PlotConfig(plotlyServerURL="https://chart-studio.plotly.com", showLink=true) | ||
pl = plot(plots, layout; config = config) | ||
|
||
config = PlotConfig(plotlyServerURL="https://chart-studio.plotly.com", showLink=true) | ||
pl = plot(plots, layout; config = config) | ||
display(pl) | ||
true | ||
end | ||
|
||
display(pl) | ||
true | ||
@info "All examples may be executed with " | ||
println("using .$(@__MODULE__); $(@__MODULE__).allrun()") | ||
|
||
end # module | ||
nothing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,46 @@ | ||
module edit_plot_examples | ||
using FinEtools | ||
using FinEtoolsFlexStructures.FESetCorotBeamModule: FESetL2CorotBeam | ||
using FinEtoolsFlexStructures.FESetL2BeamModule: FESetL2Beam | ||
using FinEtoolsFlexStructures.CrossSectionModule: CrossSectionCircle, CrossSectionRectangle | ||
using FinEtoolsFlexStructures.MeshFrameMemberModule: frame_member, merge_members | ||
using VisualStructures: plot_nodes, plot_midline, render, plot_space_box, plot_solid, space_aspectratio, default_layout_3d, plot_from_json | ||
using PlotlyJS | ||
using JSON | ||
|
||
L = 42 | ||
xyz = [0 0 0; | ||
0 L/4 L*1/4; | ||
L/4 L/4 L*2/4; | ||
L/4 0 L*3/4; | ||
0 0 L] | ||
nL = 20 | ||
function allrun() | ||
|
||
cs = CrossSectionCircle(s -> 5.9910, s -> [0.0, 0.0, 1.0]) | ||
fens, fes = frame_member(xyz, nL, cs) | ||
plots = cat(plot_nodes(fens), | ||
plot_midline(fens, fes; color = "rgb(155, 155, 255)", lwidth = 4), | ||
dims = 1) | ||
layout = default_layout_3d(width = 500, height = 500) | ||
layout[:title] = "" | ||
config = PlotConfig(plotlyServerURL="https://chart-studio.plotly.com", showLink=true) | ||
L = 42 | ||
xyz = [0 0 0; | ||
0 L/4 L*1/4; | ||
L/4 L/4 L*2/4; | ||
L/4 0 L*3/4; | ||
0 0 L] | ||
nL = 20 | ||
|
||
cs = CrossSectionCircle(s -> 5.9910, s -> [0.0, 0.0, 1.0]) | ||
fens, fes = frame_member(xyz, nL, cs) | ||
plots = cat(plot_nodes(fens), | ||
plot_midline(fens, fes; color = "rgb(155, 155, 255)", lwidth = 4), | ||
dims = 1) | ||
layout = default_layout_3d(width = 500, height = 500) | ||
layout[:title] = "" | ||
config = PlotConfig(plotlyServerURL="https://chart-studio.plotly.com", showLink=true) | ||
|
||
|
||
pl = plot(plots, layout; config=config) | ||
|
||
display(pl) | ||
pl = plot(plots, layout; config=config) | ||
|
||
savejson(pl, "plot.json") | ||
display(pl) | ||
|
||
savejson(pl, "plot.json") | ||
|
||
# The below works when run interactively from the command line: | ||
pl = plot_from_json("plot.json") | ||
pl = plot_from_json("plot.json") | ||
true | ||
end | ||
|
||
@info "All examples may be executed with " | ||
println("using .$(@__MODULE__); $(@__MODULE__).allrun()") | ||
|
||
end # module | ||
nothing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters