Skip to content

Commit

Permalink
Merge pull request #9 from rpakishore/Dev240418
Browse files Browse the repository at this point in the history
Dev240418
  • Loading branch information
rpakishore authored Nov 16, 2024
2 parents 54a3126 + cb8e709 commit 074f318
Show file tree
Hide file tree
Showing 57 changed files with 1,297 additions and 1,028 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,4 @@ dmypy.json
.vscode/settings.json
WebDriver/chromedriver.exe
nosync*
uv.lock
107 changes: 31 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,14 @@
<!-- Table of Contents -->
<h2>Table of Contents</h2>

- [1. About the Project](#1-about-the-project)
- [2. Getting Started](#2-getting-started)
- [2.1. Prerequisites](#21-prerequisites)
- [2.2. Installation](#22-installation)
- [2.2.1. Production](#221-production)
- [2.2.1.1. Install directly from repo](#2211-install-directly-from-repo)
- [2.2.1.2. Install from Pypi release](#2212-install-from-pypi-release)
- [2.2.2. Development](#222-development)
- [3. Usage](#3-usage)
- [3.1. GUI](#31-gui)
- [3.2. Layout Documentation](#32-layout-documentation)
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Production](#production)
- [Install directly from repo](#install-directly-from-repo)
- [Usage](#usage)
- [GUI](#gui)
- [Layout Documentation](#layout-documentation)
- [Layout Map](#layout-map)
- [Initialize](#initialize)
- [Parent Level](#parent-level)
Expand All @@ -54,80 +51,42 @@
- [Results](#results)
- [Material](#material)
- [Rebar](#rebar)
- [4. Roadmap](#4-roadmap)
- [5. License](#5-license)
- [6. Contact](#6-contact)
- [7. Acknowledgements](#7-acknowledgements)

<!-- About the Project -->
## 1. About the Project
- [Roadmap](#roadmap)
- [License](#license)
- [Contact](#contact)

<!-- Getting Started -->
## 2. Getting Started
## Getting Started

<!-- Prerequisites -->
### 2.1. Prerequisites
### Prerequisites

1. Python 3.11 or above
1. Python 3.12 or above
2. SAP2000 v24 or higher

<!-- Installation -->
### 2.2. Installation
### Installation

#### 2.2.1. Production
#### Production

##### 2.2.1.1. Install directly from repo
##### Install directly from repo

Clone repo and Install with flit

```bash
git clone https://github.com/rpakishore/ak_sap.git
cd ak_sap
pip install flit
git clone https://github.com/rpakishore/ak_sap.git && cd ak_sap
pip install uv
uv venv && uv pip install -r pyproject.toml --extra gui
```

- If you want just the base package:

```bash
flit install --deps production
```

- Alternatively, if you also want to include the optional streamlit gui:
- Alternatively, if you only want the base package, replace the last line above with following:

```bash
flit install --deps production --extras gui
```

##### 2.2.1.2. Install from Pypi release

```bash
pip install ak_sap
```

Note: The Pypi version does not ship with the optional streamlit gui

#### 2.2.2. Development

Download the git and install via flit

```bash
git clone https://github.com/rpakishore/ak_sap.git
cd ak_sap
pip install flit
flit install --pth-file
```

Updating Docs:

- Update the [Usage.ipynb](./documentation/Usage.ipynb).
- Open `cmd.exe` to run

```bash
update-doc
uv venv && uv pip install -r pyproject.toml
```

<!-- Usage -->
## 3. Usage
## Usage

Initialize the module as below

Expand Down Expand Up @@ -155,11 +114,11 @@ sap.api_version #Returns Sap0API version number
sap.save(r'\Path\to\save\file.sdb')
```

### 3.1. GUI
### GUI

The repo has an optional streamlit GUI for the wrapper. Checkout [`GUI.md`](/documentation/Usage/GUI.md) for installation and usage instructions.

### 3.2. Layout Documentation
### Layout Documentation

<!-- Layout START -->
#### Layout Map
Expand Down Expand Up @@ -409,7 +368,8 @@ cases.set_type(name='DEAD', casetype='LINEAR_STATIC') #Change the case type of
###### Modal
`sap.Load.Modal`
####### Eigen
**Eigen**
Usage Examples:
Expand All @@ -436,7 +396,7 @@ eigen.set_number_modes(case_name='LCASE1', max=10, min=5) #set number of modes
eigen.get_number_modes(case_name='LCASE1') #get number of modes
```
####### Ritz
**Ritz**
Usage Examples:
Expand Down Expand Up @@ -535,7 +495,7 @@ rebar.get_prop(name='MyRebar2') #Get rebar property
<!-- Layout END -->
<!-- Roadmap -->
## 4. Roadmap
## Roadmap
- [x] Generate Load Patterns
- [x] Generate Load Cases
Expand All @@ -546,18 +506,13 @@ rebar.get_prop(name='MyRebar2') #Get rebar property
- [x] Export joint reactions to Hilti-Profis file
<!-- License -->
## 5. License
## License
See [LICENSE](https://github.com/rpakishore/ak_sap/blob/main/LICENSE) for more information.
<!-- Contact -->
## 6. Contact
## Contact
Arun Kishore - [@rpakishore](mailto:[email protected])
Project Link: [https://github.com/rpakishore/ak_sap](https://github.com/rpakishore/ak_sap)
<!-- Acknowledgments -->
## 7. Acknowledgements
- [Shields.io](https://shields.io/)
Binary file added documentation/CSI_OAPI_Documentation.chm
Binary file not shown.
Binary file added documentation/CSI_OAPI_Documentation.chw
Binary file not shown.
57 changes: 26 additions & 31 deletions documentation/Usage/GUI.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,54 @@
- [1. Usage](#1-usage)
- [1.1. Attach an Instance](#11-attach-an-instance)
- [1.2. Models](#12-models)
- [1.3. Tables](#13-tables)
- [1.4. Export](#14-export)
- [1.4.1. Hilti-Profis](#141-hilti-profis)
- [Installation](#installation)
- [Usage](#usage)
- [Attach an Instance](#attach-an-instance)
- [Models](#models)
- [Tables](#tables)
- [Export](#export)
- [Hilti-Profis](#hilti-profis)

<h1> Steamlit </h1>

The package not comes pre-compiled with the streamlit package.
**Please note, the GUI is currently heavily limited in functionality and only serves to showcase the possibilities with the ak_sap module.**

# 1. Usage
The base `ak_sap` does not comes pre-compiled with the streamlit package.

- Download the Github Repo and `cd` inside
```bash
git clone https://github.com/rpakishore/ak_sap.git
cd ak_sap
```
You will need to use the `--extra gui` command during install to add the streamlit package.

- Install dependencies
# Installation

```bash
pip install flit && flit install --extras gui
```
```cmd
git clone https://github.com/rpakishore/ak_sap.git && cd ak_sap
pip install uv
uv venv && uv pip install -r pyproject.toml --extra gui
```

- Launch the app run
# Usage

```bash
gui
```
- Make sure the SAP Model you want to control is open. (Current version of gui does not support creating new SAP files)

- Alternatively, In windows launch by executing the script

```cmd
python -m streamlit run Start_Here.py
```
```cmd
uv run streamlit run Start_Here.py
```

- Open up the SAP2000 model of your choice and click `Attach to Model`

## 1.1. Attach an Instance
## Attach an Instance

![GUI-Streamlit-Start_Here.png](../assets/GUI-streamlit-Start_Here.png)

## 1.2. Models
## Models

![GUI-Streamlit-Models.png](../assets/GUI-streamlit-Models.png)

## 1.3. Tables
## Tables

![GUI-Streamlit-Tables.png](../assets/GUI-streamlit-Tables.png)

## 1.4. Export
## Export

![GUI-streamlit-Export.png](../assets/GUI-streamlit-Export.png)

### 1.4.1. Hilti-Profis
### Hilti-Profis

![GUI-streamlit-Export-Hilti.png](../assets/GUI-streamlit-Export-Hilti.png)

Expand Down
27 changes: 15 additions & 12 deletions pages/1_Model.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import streamlit as st
from ak_sap.gui.streamlit import st_initialize

from ak_sap import Sap2000Wrapper
from ak_sap.gui.streamlit import st_initialize

st.write('## Models')
st.write("## Models")
st_initialize()

if not st.session_state.get('attached'):
st.warning('[Attach to existing](/) SAP model first to use this tab')
if not st.session_state.get("attached"):
st.warning("[Attach to existing](/) SAP model first to use this tab")
st.stop()

sap:Sap2000Wrapper = st.session_state['SAP']
sap: Sap2000Wrapper = st.session_state["SAP"]
st.divider()
with st.expander('Model Info'):
with st.expander("Model Info"):
st.table(
{'Current Model Units':sap.Model.units.replace('_', ' | '),
'Current Database Units':sap.Model.units_database.replace('_', ' | '),
'Merge Tolerance': sap.Model.merge_tol,
'Is Locked': sap.Model.is_locked
})
st.divider()
{
"Current Model Units": sap.Model.units.replace("_", " | "),
"Current Database Units": sap.Model.units_database.replace("_", " | "),
"Merge Tolerance": sap.Model.merge_tol,
"Is Locked": sap.Model.is_locked,
}
)
st.divider()
26 changes: 14 additions & 12 deletions pages/3_Export.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
import streamlit as st

import importlib.util
import importlib.machinery
import importlib.util
from pathlib import Path

import streamlit as st

from ak_sap.gui.streamlit import st_initialize


def load_module_main(filename: str):
"""Specifying the python filename under the /pages/windows folder, loads the main() function from specified file.
Args:
filename (str): python filename to load the function from
"""
abs_path = Path(__file__).parent / "Export" / filename
loader = importlib.machinery.SourceFileLoader( abs_path.stem, str(abs_path) )
loader = importlib.machinery.SourceFileLoader(abs_path.stem, str(abs_path))
spec = importlib.util.spec_from_loader(abs_path.stem, loader)
mymodule = importlib.util.module_from_spec( spec ) # type: ignore
loader.exec_module( mymodule )
mymodule = importlib.util.module_from_spec(spec) # type: ignore
loader.exec_module(mymodule)
mymodule.main()

st.set_page_config(layout='wide')

st.write('## Export')
st.set_page_config(layout="wide")

st.write("## Export")
st_initialize()

if not st.session_state.get('attached'):
st.warning('[Attach to existing](/) SAP model first to use this tab')
if not st.session_state.get("attached"):
st.warning("[Attach to existing](/) SAP model first to use this tab")
st.stop()

with st.expander('Export to Hilti-Profis'):
load_module_main('hilti_export.py')
with st.expander("Export to Hilti-Profis"):
load_module_main("hilti_export.py")
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ license = {file = "LICENSE"}
classifiers = ["License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)"]
dynamic = ["version", "description"]
dependencies = [
"comtypes==1.2.0",
"comtypes>=1.4.8",
"forallpeople==2.6.7",
"pandas==2.1.3"
"pandas>=2.1.3"
]

[project.optional-dependencies]
Expand All @@ -26,7 +26,7 @@ dev = [
]

gui = [
"streamlit==1.31.0",
"streamlit==1.40.1",
"hilti_profis==0.0.3"
]

Expand Down
2 changes: 1 addition & 1 deletion src/ak_sap/Analyze/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .main import Analyze
from .main import Analyze
Loading

0 comments on commit 074f318

Please sign in to comment.