Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Does anybody know how to close an application (*.ipt & *.iam) by ilogic code?

29 REPLIES 29
Reply
Message 1 of 30
zdhrichard
792 Views, 29 Replies

Does anybody know how to close an application (*.ipt & *.iam) by ilogic code?

Does anybody know how to close an application (*.ipt & *.iam) by ilogic code?

 

I tried to use

           ThisDoc.Document.close (True)

to close it.

Indeed, it can close the application, but there is an error occurred as following:

           Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))

Does anybody know how to avoid this error or any other way to close (or exit) the application?

Rich

Autodesk Inventor Professional 2018 (64 Bit Edition)
Build: 284, Release 2018.3
Windows 7 Professional Service Pack 1
Intel(R) Xeon(R) CPU E5645
12.0 GB Memory
29 REPLIES 29
Message 2 of 30
jletcher
in reply to: zdhrichard

Do you want to close Inventor or just close the part?

Message 3 of 30
zdhrichard
in reply to: jletcher

Just *.ipt or *.iam.

Rich

Autodesk Inventor Professional 2018 (64 Bit Edition)
Build: 284, Release 2018.3
Windows 7 Professional Service Pack 1
Intel(R) Xeon(R) CPU E5645
12.0 GB Memory
Message 4 of 30
jletcher
in reply to: zdhrichard

OK need some more info or understanding.

 

You have a part that has ilogic to make the part then after you make the part you want it to close?

 

 

see we have to understand your steps in what you are doing with it.

 

 

 

Message 5 of 30
zdhrichard
in reply to: jletcher

You are right.

The reason is I do not want other people see my codes.

So, I have a *.ipt (or *.iam) file with codes (we coudl call it parent-model?). When it is opened, it will start to ask user to input part number to generate the model (child-model?).

So, when child-model is generated, I will use codes to delete all rules in child-model which you and Mike help me to get this already.

Now, because I do not want the user to see my rules. So, I need close the parent-model immidiately after user get the child model.

I just get a code which could close Inventor

         ThisApplication.Quit

But it is better just close the parent-model instead of Inventor.

Do you know any code can do this way?

Rich

Autodesk Inventor Professional 2018 (64 Bit Edition)
Build: 284, Release 2018.3
Windows 7 Professional Service Pack 1
Intel(R) Xeon(R) CPU E5645
12.0 GB Memory
Message 6 of 30
jletcher
in reply to: zdhrichard

I think your issue may be with the ilogic code you have to delet all ilogic.

 

you may have to leave the ilogic that closes the main file if you are deleted them all the error is you are deleting the closed part too.

 

This is a guess without seeing the code you have to delete all ilogic.

 

Message 7 of 30
jletcher
in reply to: jletcher

Or try this

 

oPartDoc.Close

 

 

 

Message 8 of 30
zdhrichard
in reply to: jletcher

No. The iLogic code in child-model could be delete by rules already.

 

Now, I just want to close the parent model (*.ipt or *.iam) in order user cannot see my rules.

Rich

Autodesk Inventor Professional 2018 (64 Bit Edition)
Build: 284, Release 2018.3
Windows 7 Professional Service Pack 1
Intel(R) Xeon(R) CPU E5645
12.0 GB Memory
Message 9 of 30
zdhrichard
in reply to: jletcher

Hello James,

 

Thanks lot for your reply. But could you please let me know what the type of oPartDoc is? We need declare it before use it, right?

Rich

Autodesk Inventor Professional 2018 (64 Bit Edition)
Build: 284, Release 2018.3
Windows 7 Professional Service Pack 1
Intel(R) Xeon(R) CPU E5645
12.0 GB Memory
Message 10 of 30
jletcher
in reply to: zdhrichard

Dim oPartDoc As PartDocument

 

Message 11 of 30
zdhrichard
in reply to: jletcher

Sorry, I may not make my idea very clear.

 

Just after genarating the child model, the child model will be saved to a separate files and all rules will be deleted by an external rule in child-model.

 

The parent-model will keep as it is.

 

If I could colse the parent-model imminately after generating the child-model, the user should be unable to see my rules.

 

That is the reason I need some code to close the parent-model.

Rich

Autodesk Inventor Professional 2018 (64 Bit Edition)
Build: 284, Release 2018.3
Windows 7 Professional Service Pack 1
Intel(R) Xeon(R) CPU E5645
12.0 GB Memory
Message 12 of 30
zdhrichard
in reply to: jletcher

Sorry, James,

 

PartDocument is not a good type, I think.

 

Because it will occure Errors:

 

Type 'PartDocument' is not defined.

 

And I need code to close *.iam too.

Rich

Autodesk Inventor Professional 2018 (64 Bit Edition)
Build: 284, Release 2018.3
Windows 7 Professional Service Pack 1
Intel(R) Xeon(R) CPU E5645
12.0 GB Memory
Message 13 of 30
jletcher
in reply to: zdhrichard

In your code are you using savecopyas or saveas? When making the parts.

Message 14 of 30
zdhrichard
in reply to: jletcher

For child-model, I am using

ThisDoc.Document.SaveAs(outputfile, True)

It works fine. And I can make my child-model very nice and clear (without any rules).

 

I just want to close parent-model by code after generating child model in order the user cannot read my rules in parent-model.

Rich

Autodesk Inventor Professional 2018 (64 Bit Edition)
Build: 284, Release 2018.3
Windows 7 Professional Service Pack 1
Intel(R) Xeon(R) CPU E5645
12.0 GB Memory
Message 15 of 30
swhite
in reply to: zdhrichard

I think you may get an error no matter what you do unless you use a starting dummy part to open your parent part. As when you are in the parent any code you execute to close it will cause an error as the code itself has not finished. Could you open a dummy part, which opens your parent part, execute that code then pass control back to the dummy part which closes your parent?

Steven White
Lee C. Moore, Inc.
www.lcm-wci.com
Inventor 2011
Intel Dual Xeon E31225 @ 3.1 GHz CPU
16 GB RAM
NVIDIA Quadro 600 GPU
Windows 7 - 64 Bit
Message 16 of 30
jletcher
in reply to: zdhrichard

Is this also the way you save the assembly?

 

I don't have a delete rules in my parts or assembly but the parent part should close after you generate files if you are using the code we helped you with.

 

So this is why I am lost mine closes and I don't get that error so there is something we are missing and this is where seeing the code would help.

 

Now if I just put a close ilogic in I get the error but not if I add the generate files with saveas in ilogic and the oPartDoc.close  I do not get the error.

 

But after reading the error it will not hurt anything they will have to close the error message but if that is all it is I would not worry about it. It still closes the main file.

Message 17 of 30
zdhrichard
in reply to: swhite

But still customer can open the parent part seperately.

 

If this is the case, I may use

ThisApplication.Quit

to close the Inventpr.

 

Even this way, I can control the user to read the code in *.iam, still I cannot control them to read the code in *.ipt. I need find a way in order the user cannot open the *.ipt seperately as

If *.iam is not open, then *.ipt need to be clsoed.

 

Any suggestion?

Rich

Autodesk Inventor Professional 2018 (64 Bit Edition)
Build: 284, Release 2018.3
Windows 7 Professional Service Pack 1
Intel(R) Xeon(R) CPU E5645
12.0 GB Memory
Message 18 of 30
zdhrichard
in reply to: jletcher

OK. May be the error is OK.

 

Do we have code to check whether an assembly is opened?

 

I want ot write some code in *.ipt. When it is opened, if its relative *.iam is not opened, it need to be closed immediately.

 

If we could do this, the user should be unable to read my ilogic code.

 

Rich

Autodesk Inventor Professional 2018 (64 Bit Edition)
Build: 284, Release 2018.3
Windows 7 Professional Service Pack 1
Intel(R) Xeon(R) CPU E5645
12.0 GB Memory
Message 19 of 30
jletcher
in reply to: zdhrichard

May I ask why you don't want the user to see the code? And are thee local users or you making ilogic parts for another company and don't want to give out codes so they can do it themselves ?

 

 

 

 

Message 20 of 30
jletcher
in reply to: jletcher

Oh reason I am asking I have an idea but need to know who what where there before I go into testing..

 

Mark would be able to answer it right away he is the ilogic guru.... Me I still have to test...

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report