×
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-Python cEdit class

Etabs Api-Python cEdit class

Etabs Api-Python cEdit class

(OP)
Hello Everyone:
In the auto generated python file in the comtypes folder connected to Etabs.dll there are various classes like EditFrame, EditPoint etc.. I am trying to write a code for EditPoint.ChangeCoordinates and EditFrame.DivideAtDistance but i am not able to execute it. I am getting a return value of -99 instead of 0. And there is no document on these classes in .chm file. Can any one please give a sample of an executable code..

RE: Etabs Api-Python cEdit class

Hi Raqueeb

Sorry for not getting back sooner, just had a look and doesn't look like there is anything under EditPoint or EditGeneral. Let me have a better look tomorrow morning and see if I can come up with something. I think the SapModel.EditGeneral.Move() may work but will need a selected member. Are you selecting the point through the interface or are you working in the background just relying on knowing a Point Unuique number. Likewise, a user function could be written for Divide at distance. I wrote this one a few years back, think it works for columns

CODE --> python

def subdivide_frame_insert_yloc(SapModel,frame_name,insert_y):
    """
    params frame_name,insert_y
    return None
    """
    (frame_pt0,frame_pt1,ret)=SapModel.FrameObj.GetPoints(frame_name);
    (x0,y0,z0,ret)=SapModel.PointObj.GetCoordCartesian(frame_pt0);
    (x1,y1,z1,ret)=SapModel.PointObj.GetCoordCartesian(frame_pt1);
    frame_ln=((x1-x0)**2+(y1-y0)**2+(z1-z0)**2)**0.5;
    insert_rat=(insert_y-y0)/(y1-y0);
    if(insert_rat>=1):
        print('Insert point outside member');
        return None;
    x2=round(insert_rat*(x1-x0)+x0,1);
    y2=round(insert_rat*(y1-y0)+y0,1);
    z2=round(insert_rat*(z1-z0)+z0,1);
    frame_section=SapModel.FrameObj.GetSection(frame_name)[0];
    frame_grps=SapModel.FrameObj.GetGroupAssign(frame_name);
    frame_mods=SapModel.FrameObj.GetModifiers(frame_name);
    frame_local=SapModel.FrameObj.GetLocalAxes(frame_name);
    SapModel.FrameObj.Delete(frame_name);
    new_point=SapModel.PointObj.AddCartesian(x2,y2,z2);
    new_frame_1=SapModel.FrameObj.AddByPoint(frame_pt0,new_point[0]);
    SapModel.FrameObj.SetSection(new_frame_1[0],frame_section);
    for i in range(len(frame_grps[1])):
        if(frame_grps[1][i]!='All'):
            SapModel.FrameObj.SetGroupAssign(new_frame_1[0],frame_grps[1][i]);
    SapModel.FrameObj.SetModifiers(new_frame_1[0],frame_mods[0]);
    SapModel.FrameObj.SetLocalAxes(new_frame_1[0],frame_local[0],frame_local[1]);
    new_frame_2=SapModel.FrameObj.AddByPoint(new_point[0],frame_pt1);
    SapModel.FrameObj.SetSection(new_frame_2[0],frame_section);
    for i in range(len(frame_grps[1])):
        if(frame_grps[1][i]!='All'):
            SapModel.FrameObj.SetGroupAssign(new_frame_2[0],frame_grps[1][i]);
    SapModel.FrameObj.SetModifiers(new_frame_2[0],frame_mods[0]);
    SapModel.FrameObj.SetLocalAxes(new_frame_2[0],frame_local[0],frame_local[1]);
    SapModel.View.RefreshView(True);
    return None 

RE: Etabs Api-Python cEdit class

(OP)
Hi Daniel,

Thanks for the reply, I do understand that you would be busy, sorry for troubling you. But thanks again.

I am selecting the points through the interface and using GetSelected function.

In the python generated ctypes file there is EditPoint class, which has few functions as given below, but there is no information in the .chm file, likewise there are many such functions in the generated python file for which we dont have any information in .chm file. like for example cSectionCut.

class cEditPoint(comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0.IDispatch):
_case_insensitive_ = True
_iid_ = GUID('{67761402-B408-4B43-A72E-4A434C5EAE78}')
_idlflags_ = ['dual', 'oleautomation']
cEditPoint._methods_ = [
COMMETHOD([dispid(1)], HRESULT, 'Align',
( ['in'], c_int, 'MyType' ),
( ['in'], c_double, 'Ordinate' ),
( ['in', 'out'], POINTER(c_int), 'NumberPoints' ),
( ['in', 'out'], POINTER(_midlSAFEARRAY(BSTR)), 'PointName' ),
( ['out', 'retval'], POINTER(c_int), 'pRetVal' )),
COMMETHOD([dispid(2)], HRESULT, 'ChangeCoordinates',
( ['in'], BSTR, 'Name' ),
( ['in'], c_double, 'X' ),
( ['in'], c_double, 'Y' ),
( ['in'], c_double, 'Z' ),
( ['out', 'retval'], POINTER(c_int), 'pRetVal' )),
COMMETHOD([dispid(3)], HRESULT, 'ChangeCoordinates_1',
( ['in'], BSTR, 'Name' ),
( ['in'], c_double, 'X' ),
( ['in'], c_double, 'Y' ),
( ['in'], c_double, 'Z' ),
( ['in', 'optional'], VARIANT_BOOL, 'NoRefresh', False ),
( ['out', 'retval'], POINTER(c_int), 'pRetVal' )),
COMMETHOD([dispid(4)], HRESULT, 'Connect',
( ['in', 'out'], POINTER(c_int), 'NumberPoints' ),
( ['in', 'out'], POINTER(_midlSAFEARRAY(BSTR)), 'PointName' ),
( ['out', 'retval'], POINTER(c_int), 'pRetVal' )),
COMMETHOD([dispid(5)], HRESULT, 'Disconnect',
( ['in', 'out'], POINTER(c_int), 'NumberPoints' ),
( ['in', 'out'], POINTER(_midlSAFEARRAY(BSTR)), 'PointName' ),
( ['out', 'retval'], POINTER(c_int), 'pRetVal' )),
COMMETHOD([dispid(6)], HRESULT, 'Merge',
( ['in'], c_double, 'MergeTol' ),
( ['in', 'out'], POINTER(c_int), 'NumberPoints' ),
( ['in', 'out'], POINTER(_midlSAFEARRAY(BSTR)), 'PointName' ),
( ['out', 'retval'], POINTER(c_int), 'pRetVal' )),
]

thanks for the code you have shared above.

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


Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

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