How to "secure" my code from others?

How to "secure" my code from others?

Anonymous
Not applicable
973 Views
10 Replies
Message 1 of 11

How to "secure" my code from others?

Anonymous
Not applicable

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?

0 Likes
974 Views
10 Replies
Replies (10)
Message 2 of 11

Anonymous
Not applicable

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.

0 Likes
Message 3 of 11

strandvata
Contributor
Contributor
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
0 Likes
Message 4 of 11

rossano_praderi
Collaborator
Collaborator

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!
---------------
0 Likes
Message 5 of 11

Anonymous
Not applicable
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.
0 Likes
Message 6 of 11

strandvata
Contributor
Contributor

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
0 Likes
Message 7 of 11

rossano_praderi
Collaborator
Collaborator

Hi Tommy,

the basic example posted by Ivan is a good start.

If you want more informations you can check the follow links:

 

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

 

These are very basic examples on how to use Ilogics together with a compiled library developed with Visual Studio Express edition.
I also think it's a good choice if you need to create 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!
---------------
0 Likes
Message 8 of 11

nmunro
Collaborator
Collaborator
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

0 Likes
Message 9 of 11

rossano_praderi
Collaborator
Collaborator

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!
---------------
0 Likes
Message 10 of 11

Anonymous
Not applicable

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.)?

0 Likes
Message 11 of 11

Anonymous
Not applicable
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.
0 Likes