# Extracting Start and End Points from Lines for RSA API by using python

**URL:** <https://forum.dynamobim.com/t/extracting-start-and-end-points-from-lines-for-rsa-api-by-using-python/97338>\
**Category:** Uncategorized\
**Tags:** python, dynamo\
**Created:** [January 19, 2024, 6:54pm UTC](https://forum.dynamobim.com/t/extracting-start-and-end-points-from-lines-for-rsa-api-by-using-python/97338 "2024-01-19T18:54:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ugur\_yavan\_61](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ugur_yavan_61/32/160009_2.png) [@ugur\_yavan\_61](https://forum.dynamobim.com/u/ugur_yavan_61)\
**Post date:** [January 19, 2024, 6:54pm UTC](https://forum.dynamobim.com/t/extracting-start-and-end-points-from-lines-for-rsa-api-by-using-python/97338/1 "2024-01-19T18:54:52Z")

</div>

Hello everyone,

I have a list of lines for which I need to obtain the start and end point coordinates. My goal is to create these lines in RSA using the RSA API. Below is the logic I’m planning to use:

```auto

# Import the RSA API libraries
import clr
clr.AddReference('RobotOM')
import RobotOM

# Function to translate Dynamo lines to RSA nodes and bars
def translate_line_to_rsa(line, rsa_model):
    start_point = line.StartPoint
    end_point = line.EndPoint
    
    # Create nodes at the start and end of the line
    start_node_id = rsa_model.Project.Structure.Nodes.Create(start_point.X, start_point.Y, start_point.Z)
    end_node_id = rsa_model.Project.Structure.Nodes.Create(end_point.X, end_point.Y, end_point.Z)
    
    # Create a bar between the start and end nodes
    bar_id = rsa_model.Project.Structure.Bars.Create(start_node_id, end_node_id)
    
    # Set the section for the bar (example section name)
    rsa_model.Project.Structure.Bars.Get(bar_id).SetSection('EXAMPLE_SECTION_NAME')
    
    return bar_id

# Connect to RSA
robot_app = RobotOM.RobotApplicationClass()
robot_app.Interactive = False
robot_project = robot_app.Project
robot_structure = robot_project.Structure

# Assume 'lines' is a list of Dynamo lines passed into the script
for line in IN[0]: # IN[0] is where Dynamo inputs are accessed
    translate_line_to_rsa(line, robot_project)

# Finalize changes in RSA
robot_structure.FinishEdition()

# Return something if needed
OUT = "Script completed"

```

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/4/a4637c1216b050272430cd416a99db9f0f58e9d8.jpeg)

However, I believe there is no command like `line.StartPoint` . Can anyone suggest an alternative or provide guidance on this matter?"

---

<div class="post-metadata">

**Author:** ![bharat.minocha](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/bharat.minocha/32/174524_2.png) [@bharat.minocha](https://forum.dynamobim.com/u/bharat.minocha)\
**Post date:** [January 20, 2024, 6:29am UTC](https://forum.dynamobim.com/t/extracting-start-and-end-points-from-lines-for-rsa-api-by-using-python/97338/2 "2024-01-20T06:29:27Z")

</div>

@ugur_yavan_61 [Quickstart Guide for Dynamo in RSA 2023 - Robot Structural Analysis - Dynamo (dynamobim.com)](https://forum.dynamobim.com/t/quickstart-guide-for-dynamo-in-rsa-2023/77837)

Did u read this ??

i don’t have the RSA documentation but in revit api startpoint and end point work in this manner with this method of “GetEndPoint” , Here if need startpoint passing indes as 0 and 1 for the endpoint so u could see if there’s something similar to this exist in RSA Api.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/c/dc0151ecbb13732a6b2353820887c97d1a7d8d20.png)

Thanks,  
BM

---

<div class="post-metadata">

**Author:** ![ugur\_yavan\_61](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ugur_yavan_61/32/160009_2.png) [@ugur\_yavan\_61](https://forum.dynamobim.com/u/ugur_yavan_61)\
**Post date:** [January 20, 2024, 10:37am UTC](https://forum.dynamobim.com/t/extracting-start-and-end-points-from-lines-for-rsa-api-by-using-python/97338/3 "2024-01-20T10:37:38Z")

</div>

> [@bharat.minocha](#):
>
> revit api

Thank you for your reply.  
Is there any way to do it by using Autodesk design script Geometry ? We can use the code in code block as in the figure. Can’t we use same command in python ?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/d/9d3f687cfa3094bd06ebe9bdfb21d59af82e32df.jpeg)

---

<div class="post-metadata">

**Author:** ![bharat.minocha](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/bharat.minocha/32/174524_2.png) [@bharat.minocha](https://forum.dynamobim.com/u/bharat.minocha)\
**Post date:** [January 20, 2024, 11:35am UTC](https://forum.dynamobim.com/t/extracting-start-and-end-points-from-lines-for-rsa-api-by-using-python/97338/4 "2024-01-20T11:35:10Z")

</div>

hey @ugur_yavan_61

> [@ugur\_yavan\_61](#):
>
> Can’t we use same command in python

Here i have brokendown what u asked for in multiple scenarios and kept 3 ways however the scenario u encounter during execution, please go though it and hopefully it resolves your query and help u meet your goal

 ![yuvan](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/c/dc387fcf203f22bfa145d48c903f2dccd1ad715f.png)  
Thanks  
BM
