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?
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.
Hi Tommy,
this is an other post with the same argument.
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
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
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
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
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.)?