Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Ram Concept - Python scripting 1

Status
Not open for further replies.

rscassar

Structural
Jul 29, 2010
631
0
0
AU
Did anyone notice that Ram Concept V8.2 now has python scripting. Has anyone had a go at this with any luck?
 
Replies continue below

Recommended for you

works, few teething programs but ready to start Ram Concept scripting

ram_concept_njju01.png
 
Very cool! I've been wanting to hop into this, just have not gotten around to it yet.

There are a few painful operations in concept that I would like to see if automation could solve.

S&T
 
It is very much in its infancy but hooked into some of the basic features of modeling and load application.

Be very aware though that running a script counts as using the program from a licensing perspective so be careful of generating overages by playing around with the scripting.

My Personal Open Source Structural Applications:

Open Source Structural GitHub Group:
 
- Load Take Down
- Automated Drafting utilizing Dynamo and Revit
- Easier/Automated load layout ( snow and wind loads on roofs comes to mind)
- Easier/Automated modelling from Revit to Concept
- Attempt to do PT tendon layout optimization (can pay extra to send your model to their cloud servers to perform this step currently)

My Personal Open Source Structural Applications:

Open Source Structural GitHub Group:
 
The first thing I've done with is so far is some getter functions. Walls and columns reactions are good, I'm going to look at generating some easier designs like core bases. Need python 3.8.

Python:
# -*- 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;
 
Anyone have tried to get tendons shop drawing from ram concept with the api ? Or may be modelling of co crete dimensions specially column with an easy way using the api ?
 
Tendon profiles could be done easily, it's been a while since I've worked on my python script but looks like it could be done. Unsure what the second part of your question is

Or may be modelling of co crete dimensions specially column with an easy way using the api ?
 
here's one that can get you jacks information. Continuing from the script above

Python:
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;
 
Thanks for your helo,but i have some questions here and i will be glade if you can answer me because i am new to all of the coding and api stuff.

1-
1_nqqtxh.png
2_vyxicy.png
Is the code you providing getting tendons chairs or profile between the main profile points ? For example gives the chair height every 1m (Just like the attached pictures)

2- You know when we model concrete dimensions in mesh input in ram concept, the columns, beams and openings takes alot of time to be drawn especially when columns are alot and have different sizes same for beam and openings. And ram concept is not like safe or etabs or adapt as it doesn't make modeling of elements automaticly and you have to draw it by hand. so my question is could api help in that by any way ? for example can we make dxf in a certian way and the program understands it and automaticly draw column and openings and beams ?

3- my third question is that i am new to api stuff so i don't know how to apply them to ram concept and make them work can ypu please help me in that ?

It will be very generous of you to answer my questions, Thanks in advance
 
Status
Not open for further replies.
Back
Top