rscassar
Structural
- Jul 29, 2010
- 631
Did anyone notice that Ram Concept V8.2 now has python scripting. Has anyone had a go at this with any luck?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
# -*- coding: utf-8 -*-
import os;
import sys;
import time;
from pathlib import Path
api_path='C:\\path_to_python_folder\\RAM Concept CONNECT Edition V8\\python';
if(api_path not in sys.path):
sys.path.append(api_path);
import ram_concept as rc;
from ram_concept.concept import Concept
from ram_concept.model import DesignCode
from ram_concept.model import Model
from ram_concept.model import StructureType
#define the file path that is to be used
file_path='C:\\path_to_ram.cpt';
def attachToInstanceRam(model_path,headless=False):
"""
attach to RamConcept model
"""
#check that the file path exists
if(os.path.isfile(model_path)==False):
print('File {} does not exists'.format(model_path));
return False;
#attach to the model, every call will be thru concept
concept=rc.concept.Concept.start_concept(headless);
#open the model
model=concept.open_file(model_path);
return model,concept;
def get_materials_concrete(model):
"""
Get the concrete mixes in the model
returns: conc_mixes (dict)
"""
#get the model mixes
conc_mixes={};#[['Mix Name','Density','Density for Loading','fci','fc','fcui','fcu',
#'Poissons','Thermal','Ec Calc','User Eci','User Ec']];
for mix in model.concretes.concretes:
mix_name=mix.name;
coefficient_of_thermal_expansion=mix.coefficient_of_thermal_expansion;
fc_initial=mix.fc_initial;
fc_final=mix.fc_final;
fcu_initial=mix.fcu_initial;
fcu_final=mix.fcu_final;
poissons_ratio=mix.poissons_ratio;
unit_mass=mix.unit_mass;
unit_unit_mass_for_loads=mix.unit_unit_mass_for_loads;
if(unit_unit_mass_for_loads>10**4):
unit_unit_mass_for_loads='Density';
user_Ec_initial=mix.user_Ec_initial;
user_Ec_final=mix.user_Ec_final;
use_code_Ec=mix.use_code_Ec;
conc_mixes[mix_name]={'unit_mass':unit_mass,
'unit_unit_mass_for_loads':unit_unit_mass_for_loads,
'fc_initial':fc_initial,
'fc_final':fc_final,
'fcu_initial':fcu_initial,
'fcu_final':fcu_final,
'poissons_ratio':poissons_ratio,
'coefficient_of_thermal_expansion':coefficient_of_thermal_expansion,
'use_code_Ec':use_code_Ec,
'user_Ec_initial':user_Ec_initial,
'user_Ec_final':user_Ec_final};
return conc_mixes;
def get_pt_systems(model):
"""
Get the pt systems defined in the model
returns: pt_systems (dict)
"""
#get the model pt systems
pt_systems={};
for pt in model.pt_systems.pt_systems:
pt_name=pt.name;
Aps=pt.Aps;
Eps=pt.Eps;
Fpu=pt.Fpu;
Fpy=pt.Fpy;
Fse=pt.Fse;
anchor_friction=pt.anchor_friction;
angular_friction=pt.angular_friction;
duct_width=pt.duct_width;
jack_stress=pt.jack_stress;
long_term_losses=pt.long_term_losses;
min_curvature_radius=pt.min_curvature_radius;
seating_distance=pt.seating_distance;
strands_per_duct=pt.strands_per_duct;
system_type=pt.system_type.name;
wobble_friction=pt.wobble_friction;
pt_systems[pt_name]={'Aps':Aps,
'Eps':Eps,
'Fpu':round(Fpu,2),
'Fpy':Fpy,
'Fse':Fse,
'anchor_friction':anchor_friction,
'angular_friction':angular_friction,
'duct_width':duct_width,
'jack_stress':jack_stress,
'long_term_losses':long_term_losses,
'min_curvature_radius':min_curvature_radius,
'seating_distance':seating_distance,
'strands_per_duct':strands_per_duct,
'system_type':system_type,
'wobble_friction':wobble_friction};
return pt_systems;
def get_tendon_elevations(model):
"""
get the tendon elevations from the model
"""
#get the pt systems
pt_systems=get_pt_systems(model);
#get the tendon layer
tendon_layers=model.cad_manager.tendon_layers;
#initiate the jacks dictionary
jacks_data={};
for tendon_layer in tendon_layers:
layer_name=tendon_layer.name;
gen_by=tendon_layer.generated_by.name;
jacks=tendon_layer.jacks;
span_set=tendon_layer.span_set;
tend_nodes=tendon_layer.tendon_nodes;
tend_segs=tendon_layer.tendon_segments;
#get the jacks
for jack in jacks:
jack_number=jack.number;
jack_uid=jack.uid;
elong=round(jack.elongation,1);
loc=[jack.location.x,jack.location.y];
node=jack.node;
node_connected_segs=node.connected_tendon_segments();
anchor_fric=jack.anchor_friction;
angular_fric=jack.angular_friction;
jack_stress=jack.jack_stress;
long_term_losses=jack.long_term_losses;
seating_dist=jack.seating_distance;
use_pt_system_defaults=jack.use_pt_system_defaults;
wobble_fric=jack.wobble_friction;
node_number=node.number;
node_uid=node.uid
node_elev=node.elevation;
node_elev_ref=node.elevation_reference.name;
node_elev_value=node.elevation_value;
node_soffit=node.soffit;
node_surface=node.surface;
seg_numbers={};
for seg in node_connected_segs:
seg_number=seg.number;
seg_system=seg.pt_system.name;
#get some data about the segment
strand_count=round(seg.strand_count,3);
aps=pt_systems[seg_system]['Aps'];
node_1=seg.node_1.number;
node_2=seg.node_2.number;
if(node_number==node_1):
seg_stress=round(seg.stress_at_end_1,3);
jack_end=1;
elif(node_number==node_2):
seg_stress=round(seg.stress_at_end_2,3);
jack_end=2;
jack_force=round(jack_stress*aps*strand_count*10**-3,3);
seg_numbers[seg_number]={'strand_count':strand_count,
'seg_stress':seg_stress,
'jack_end':jack_end,
'jack_force':jack_force};
jacks_data[jack_uid]={'layer_name':layer_name,
'gen_by':gen_by,
'jack_number':jack_number,
'elong':elong,
'loc':loc,
'anchor_fric':anchor_fric,
'angular_fric':angular_fric,
'jack_stress':jack_stress,
'long_term_losses':long_term_losses,
'seating_dist':seating_dist,
'use_pt_system_defaults':use_pt_system_defaults,
'wobble_fric':wobble_fric,
'node_number':node_number,
'node_uid':node_uid,
'node_elev':node_elev,
'node_elev_ref':node_elev_ref,
'node_elev_value':node_elev_value,
'node_soffit':node_soffit,
'node_surface':node_surface,
'seg_numbers':seg_numbers};
return jacks_data;