Kamran Zulfiqar
Update app.py
cafcf3b verified
import streamlit as st
# Set up the page configuration
st.set_page_config(page_title="AutoCAD Command Explorer", layout="wide")
# Commands categorized by functionality (add as many as necessary)
commands = {
"DRAWING": {
"3DORBIT": {
"description": "Rotates the view in 3D space around a pivot point.",
"link": "https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-3DORBIT"
},
"LINE": {
"description": "Creates straight line segments between two points.",
"link": "https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-LINE"
},
"CIRCLE": {
"description": "Creates a circle based on a center point and radius.",
"link": "https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-CIRCLE"
},
"ARC": {
"description": "Creates an arc defined by three points.",
"link": "https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-ARC"
},
"SPLINE": {
"description": "Creates a spline curve through a set of points.",
"link": "https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-SPLINE"
}
},
"MODIFYING": {
"MOVE": {
"description": "Moves objects a specified distance in a specified direction.",
"link": "https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-MOVE"
},
"COPY": {
"description": "Copies objects a specified distance in a specified direction.",
"link": "https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-COPY"
},
"ROTATE": {
"description": "Rotates objects around a base point.",
"link": "https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-ROTATE"
},
"SCALE": {
"description": "Scales objects proportionally from a specified base point.",
"link": "https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-SCALE"
},
"EXPLODE": {
"description": "Breaks a compound object into its constituent objects.",
"link": "https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-EXPLODE"
}
},
"DIMENSIONS": {
"DIMLINEAR": {
"description": "Creates a linear dimension between two points.",
"link": "https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-DIMLINEAR"
},
"DIMRADIUS": {
"description": "Creates a dimension that measures the radius of a circle or arc.",
"link": "https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-DIMRADIUS"
},
"DIMDIAMETER": {
"description": "Creates a dimension that measures the diameter of a circle or arc.",
"link": "https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-DIMDIAMETER"
}
},
"VIEWING": {
"ZOOM": {
"description": "Changes the view of your drawing to a specific zoom level.",
"link": "https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-ZOOM"
},
"PAN": {
"description": "Pans the view of your drawing.",
"link": "https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-PAN"
},
"3DVIEW": {
"description": "Sets the 3D view angle and position.",
"link": "https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-3DVIEW"
}
},
"LAYER_MANAGEMENT": {
"LAYER": {
"description": "Manages drawing layers and their properties.",
"link": "https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-LAYER"
},
"LAYERSTATE": {
"description": "Saves and restores layer settings.",
"link": "https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-LAYERSTATE"
}
},
"OTHER": {
"UNDO": {
"description": "Reverses the last action or command.",
"link": "https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-UNDO"
},
"REDO": {
"description": "Reapplies the most recent undone action.",
"link": "https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-REDO"
},
"SAVE": {
"description": "Saves the current drawing to a file.",
"link": "https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-SAVE"
}
}
}
# Custom CSS for styling
st.markdown("""
<style>
.stApp {
background-color: #e6f0ff;
}
.title {
font-size: 36px;
color: #003366;
text-align: center;
font-weight: bold;
margin-bottom: 30px;
}
.desc-box {
background-color: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
margin-top: 20px;
}
.desc-title {
font-size: 24px;
color: #003366;
font-weight: bold;
margin-bottom: 10px;
}
.desc-text {
font-size: 16px;
color: #333333;
}
.desc-link a {
font-size: 15px;
color: #0077cc;
text-decoration: none;
font-weight: bold;
}
</style>
""", unsafe_allow_html=True)
# Title
st.markdown('<div class="title">πŸ“˜ AutoCAD Command Explorer</div>', unsafe_allow_html=True)
# Filter categories
categories = list(commands.keys())
# Category filter dropdown
category = st.selectbox("Select a Category:", categories)
# Get the list of commands from the selected category
category_commands = commands[category]
# Command dropdown in selected category
selected_cmd = st.selectbox("Select a Command:", sorted(category_commands.keys()))
# Layout: Description on the right
col1, col2 = st.columns([1, 2])
with col1:
# Show description and link of the selected command
cmd = category_commands[selected_cmd]
st.markdown(f"""
<div class="desc-box">
<div class="desc-title">πŸ› οΈ {selected_cmd}</div>
<div class="desc-text">{cmd['description']}</div>
<div class="desc-link">
πŸ“– <a href="{cmd['link']}" target="_blank">Learn More</a>
</div>
</div>
""", unsafe_allow_html=True)