Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to "secure" my code from others?

10 REPLIES 10
Reply
Message 1 of 11
TommySWE
676 Views, 10 Replies

How to "secure" my code from others?

I've made a part which is driven by a whole lot of iLogic code and generates constructions for my company,

I would like to secure the code so that our partners and competitors will not be able to make use of our hard work.

 

The part contains a rule and a form that sets a lot of parameters. We we're considering making the rule external and the form global in order to "blank" the part itself. Of course the parameters are all still in the part, but probably quite useless as the part crashes very easily without the driving code.

 

What would you suggest as a way of safeguarding the code in the part, in order to keep it internal at our office only?

10 REPLIES 10
Message 2 of 11
cparnell
in reply to: TommySWE

TommySWE:

 

I don't know iLogic, but I did find this link:

http://www.cadlinecommunity.co.uk/Blogs/Blog.aspx?ScoId=79754e24-e639-47ae-993f-71871cb2b48c

I have seen a different Password routine but could not find it.

It does reside in a single file and uses parameters that exist in the file.

You might be able to create a routine that creates the needed parameters for any standard Inventor file type and use a similar code.

 

Hope this help.

Message 3 of 11
strandvata
in reply to: TommySWE

There's a way to use external libraries (dll) in your ILogic.
I tested it once and it worked.
I encapsulated my business logic in a dll and than used it within iLogic.
If you think it could be useful to you I will give you more detail.
Greetings,
Ivan
Ivan Temelkov
Autodesk Inventor Customization Enthusiast
www.inventiveworkflows.it
Message 4 of 11
rossano_praderi
in reply to: TommySWE

Hi Tommy,

this is an other post with the same argument.

 

http://forums.autodesk.com/t5/inventor-customization/possibility-to-hide-ilogic-code-from-end-users/...

 

My opinion is to make an external rule or build a .dll with your code, as the other have suggested.

 

Is much easier to use Visual Studio Express for create UI, compared to write code with the Ilogics editor.

 

Bregs

Rossano Praderi



--------------------------------------
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
---------------
Message 5 of 11
TommySWE
in reply to: rossano_praderi

Both suggestions of external rules and creating a .dll are interesting to me. Where would the .dll have to be placed in order for it to work?

I haven't relly used the Visual Studio Express software at all, I've done all my coding in the ilogic editor in Inventor.
Message 6 of 11
strandvata
in reply to: TommySWE

Hi Tommy!
I’ll explain how I managed to use a dll library in Inventor iLogic.
In order to create the dll itself I used Visual Studio Express.
I created a Class Library project called MySampleLibrary.

My class inside this project is something like this:

Imports Inventor
Imports System.Runtime.InteropServices
Imports System.Windows.Forms

Public Class SampleClass

    ' I create this variable in order to get access to the Inventor application from within the class
    Public _invApp As Inventor.Application

    ''' <summary>
    ''' This is a standard function that grants access to the Inventor application
    ''' </summary>
    ''' <returns>Returns true if successful</returns>
    ''' <remarks></remarks>
    Private Function InitInventorApp() As Boolean
        Try
            _invApp = Marshal.GetActiveObject("Inventor.Application")
            InitInventorApp = True

        Catch ex As Exception
            InitInventorApp = False
        End Try
    End Function

    Public Sub MySampleSub()
        If InitInventorApp() Then
            If _invApp.Documents.Count > 0 Then
                MessageBox.Show(_invApp.ActiveDocument.DisplayName, "SampleClass.MySampleSub", MessageBoxButtons.OK)
            End If

            ' Do some cooler stuff here

        Else
            MessageBox.Show("Unexpected error occured!", "External dll error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub

End Class


Than in Inventor I created a Rule and my code goes like this:

AddReference "MySampleLibrary.dll"

Imports SampleClass

Sub Main
	Dim myCopyParam As InvSkelCopyParam.SampleClass
	
	myCopyParam = New InvSkelCopyParam.SampleClass
	
	Call myCopyParam.MySampleSub
	
	
	myCopyParam = Nothing
End Sub

The question is where to put the dll file.
You can change the code inside the rule like this:

AddReference "<Path to DLL>\MySampleLibrary.dll"

But I prefer to set the search path from the Ribbon Tools – Options – iLogic configuration.
This is how I did it. I hope it could be useful to you also.
Ciao,
Ivan

Ivan Temelkov
Autodesk Inventor Customization Enthusiast
www.inventiveworkflows.it
Message 7 of 11
rossano_praderi
in reply to: TommySWE

Hi Tommy,

the basical example posted by Ivan is a good start, if you want more informations you can check the follow links, you know these sites.

 

http://usa.autodesk.com/adsk/servlet/index?id=1079044&siteID=123112
http://modthemachine.typepad.com/
http://inventortrenches.blogspot.com.tr/

 

You will find an other example of how to use Ilogics and with a .dll external library on my site, follow this link.
http://www.dshortway.com/?p=129

 

I made two simple forms, the first is used to add a find&replace functionality within a drawing. The second form help to find&replace referenced documents in the drawing.

 

These are very basical examples on how you can use Ilogics and a compiled library developed with Visual Studio Express edition.
Also i think is a good choice if you need to made forms for your rules.

 

I believe one day the Ilogics editor can become useful.

 

 

Bregs

Rossano Praderi



--------------------------------------
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
---------------
Message 8 of 11
nmunro
in reply to: rossano_praderi

Just be aware that dll's may not provide you with any protection either. If you use VB.NET or C# and compile the dll with the standard compiler it is fairly trivial to decompile the dll to recover your source code.

Neil

        


https://c3mcad.com

Message 9 of 11
rossano_praderi
in reply to: nmunro

That's true Neil, but in the first post Tommy has clearly explained his request.
It's not supposed to use the compiled .dll (or the external rule) outside their company, the code will be kept inside the company.

 

Bregs

Rossano Praderi



--------------------------------------
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
---------------
Message 10 of 11
TommySWE
in reply to: strandvata

I will be trying to make a .dll very soon as it seems like a good way to go for us. I downloaded Visual Studio Community as Express seems to need a microsoft account.

 

I tried making the rule external and just running it like that from the same form that I have since before, but the behavior is different? I set the rule to run whenever a parameter changes with the event triggers, but it still doesn't behave the same (instant) way as the local rule embedded in the part. It's as if the rule doesnt trigger properly if its external. Does someone know why this would happen with an external rule, and how to remedy it?

 

Just using the external rule would be very simple for us I think, and less complicated than creating a .dll. On the topic of the .dll, where in the .dll do I paste my iLogic code, and will the code from my rule work without any further modifications (I have several subs and so on.)?

Message 11 of 11
TommySWE
in reply to: TommySWE

As an addition to my above post I think that the parameter changes that the external rule doesn't react to are string parameters? I have several multi-value string that are in combo boxes for choosing "Horizontal"/"Vertical" and similar values. If I input a numeric value to, say, "width", then it does run the external rule and changes the model according to the input value.

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

Post to forums