Using the DocumentOpen.Execute(r"---") to open a document

Member, Employee Posts: 11
Name Dropper First Comment
✭✭✭

Welcome!

It looks like you're new here. Sign in or register to get started.

Answers

  • Member, Employee Posts: 11
    Name Dropper First Comment
    ✭✭✭

    When recording a script in SpaceClaim, Documentopen.Execute(r"____") for relative path or Documentopen.Execute("____") for absolute path is written. I remember this script working in previous versions, however, in 23R1, this does not seem to be working, even with the latest API. Any help on this is appreciated. Thank you!

  • Moderator, Employee Posts: 128
    100 Comments 25 Likes Second Anniversary 5 Answers
    ✭✭✭✭

    @RK

    The 'r' prefix in the path string is not for relative path. It asks python to consider path as raw string.

    If you give absolute path with 'r' in as prefix then it should work. If you do not use 'r' then I would suggest you to use forward slash "/" instead of backward slash "\". When using backward slash , it would consider string based on string literals. https://docs.python.org/2/reference/lexical_analysis.html#grammar-token-stringliteral

    The DocumentOpen.Execute API works as expected in 2023R1.

  • Member, Employee Posts: 11
    Name Dropper First Comment
    ✭✭✭

    Hello @Rajesh Meena , thank you again for your response!

    I tried this script to read in a geometry located in the D drive:

    DocumentOpen.Execute(r"D:\test\Geom\fins-1-0139 - Copy.scdoc", FileSettings1)

    I am still unable to load the geometry. Any suggestions as to where I am going wrong?

Welcome!

It looks like you're new here. Sign in or register to get started.