×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Etabs Api : NewGridOnly Method

Etabs Api : NewGridOnly Method

Etabs Api : NewGridOnly Method

(OP)
Can you please help me with this code
I am getting the same Grid spacing But I want different spacing

import comtypes.client
import os
import sys

# Set the following flag to True to attach to an existing instance of the program
# Otherwise, a new instance of the program will be started
AttachToInstance = False

# Set the following flag to True to manually specify the path to ETABS.exe
# This allows for a connection to a version of ETABS other than the latest installation
# Otherwise, the latest installed version of ETABS will be launched
SpecifyPath = False

# If the above flag is set to True, specify the path to ETABS below
ProgramPath = "C:\\Program Files (x86)\\Computers and Structures\\ETABS 18\\ETABS.exe"

# Full path to the model
# Set it to the desired path of your model
APIPath = 'C:\\CSi_ETABS_API_Example'
if not os.path.exists(APIPath):
try:
os.makedirs(APIPath)
except OSError:
pass
ModelPath = APIPath + os.sep + 'API_1-001.edb'

try:
if AttachToInstance:
# Attach to a running instance of ETABS
try:
# Get the active ETABS object
myETABSObject = comtypes.client.GetActiveObject("CSI.ETABS.API.ETABSObject")
except (OSError, comtypes.COMError):
print("No running instance of the program found or failed to attach.")
sys.exit(-1)
else:
# Create API helper object
helper = comtypes.client.CreateObject('ETABSv1.Helper')
helper = helper.QueryInterface(comtypes.gen.ETABSv1.cHelper)
if SpecifyPath:
try:
# Create an instance of the ETABS object from the specified path
myETABSObject = helper.CreateObject(ProgramPath)
except (OSError, comtypes.COMError):
print("Cannot start a new instance of the program from " + ProgramPath)
sys.exit(-1)
else:
try:
# Create an instance of the ETABS object from the latest installed ETABS
myETABSObject = helper.CreateObjectProgID("CSI.ETABS.API.ETABSObject")
except (OSError, comtypes.COMError):
print("Cannot start a new instance of the program.")
sys.exit(-1)

# Start ETABS application
myETABSObject.ApplicationStart()

SapModel = myETABSObject.SapModel

# Initialize model
SapModel.InitializeNewModel()

# Define grid system parameters
NumberStorys = 3
TypicalStoryHeight = 12
BottomStoryHeight = 12
Lines_X = 4
Lines_Y = 4

# Define different spacings for each line along X and Y axes
SpacingX = [5, 8, 13] # Adjust these values for desired spacing along X axis
SpacingY = [5, 8, 13] # Adjust these values for desired spacing along Y axis

# Create grid lines with different spacings along X axis
for i in range(Lines_X ):
for k in range(Lines_Y):
ret = SapModel.File.NewGridOnly(NumberStorys, TypicalStoryHeight, BottomStoryHeight,
Lines_X, Lines_Y, SpacingX[i],SpacingY[k])


# myETABSObject.ApplicationExit(False)

except Exception as e:
print(f"Error: {e}")

RE: Etabs Api : NewGridOnly Method

I have had more luck with gridlines using the database tables

RE: Etabs Api : NewGridOnly Method

(OP)
Can you help with this code?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close