Is it possible to use ThisApplication.CommandManager in Inventor Design Automation? - autodesk-forge

I have an iLogic rule tied to an Event Trigger in an Inventor drawing. The rule contains the following line of code;
Call ThisApplication.CommandManager.ControlDefinitions.Item("DrawingArrangeDimensionsCmd").Execute()
While the above line works fine in Inventor Desktop, it is causing a failure in Inventor Design Automation. I have isolated the issue to this line because if this line is commented out, the rule runs fine in IDA.
The purpose of the above line of code is to call the "Arrange Dimensions" command. I suspect perhaps that calling commands is not allowed in IDA, but need to confirm.

Avoid to use direct command execution on DA. Use appropriate method from API instead.
In this case it is a method DrawingDimensions.Arrange Method

Related

RUN iLogic rule on drawing (old C360_OnPublish)

when we used configurator 360 we could start a rule on the Inventor Drawing (idw) simply by calling it "C360_OnPublish".
Now with Forge it doesn't work anymore.
Run Rule is essential to be able to do a quick scaling of the view after a configuration update the drawing, and before the PDF is published.
Is there a quick method that allows you to do the same thing?
we also tried to insert the rule in the Inventor EventTriggers ('Before save document' or 'Drawing view change') but without success.
thank you
Configurator 360 is available in Design Automation. You would need to trigger the rule yourself using Inventor API, depending on your code logic.
You can run directly iLogic macro from your FDA AppBundle. You need to obtain the iLogic Addin first and then start a method from this Addin.
ApplicationAddIn iLogicAddIn = inventorApplication.ApplicationAddIns.ItemById["{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}"];
dynamic iLogicAutomation = iLogicAddIn.Automation;
iLogicAutomation.RunRule(doc, "Your_iLogic_script");
Another option is to run the iLogic script directly from your activity without the AppBundle, but there are some caveats related to that, mainly long operations without any output and with missing heart beating can cause the processing timeouts. This video demonstrates how to do that:
https://youtu.be/kA82e_XcMrY?t=100

ANE Extension Context null

I am using FreshPlanet KeyboardSize ANE in my project. I have successfully added to my project but when I run
MeasureKeyboard.getInstance().setKeyboardAdjustNothing();
I get the following error.
ArgumentError: Error #3500: The extension context does not have a method with the name setKeyboardAdjustNothing.
at flash.external::ExtensionContext/_call()
at flash.external::ExtensionContext/call()
at com.freshplanet.ane.KeyboardSize::MeasureKeyboard/setKeyboardAdjustNothing()e
How can I fix this?
Thanks.
Make sure both your Application-app.xml from the src and from your bin-debug folder contain the NAME_OF_THE_EXTENSION_ID tag matching exactly what is being called in your ExtensionContext.createExtensionContext(NAME_OF_THE_EXTENSION_ID,null) inside the source code of the ANE. If they don't match you'll not be able to set the external context in the initialization. That should also match the alias from your RemoteClass descriptor before the class declaration. I hope it's helpful info.
In my case what happened was that MSVCR (Microsoft visual c++ redistribution) was missing which is required to run c++ code.
Because the code in the extension was not able to run, the app could not find any function included in the ANE.
Make sure the code of your ANE is able of running either by writing logs or by running some sample native code independently.

Manifest for dependencies on items other than the main executable?

I'll explain what i'm trying to do (and why) first and then get more into the details.
I'm trying to get Registration Free COM activation working in the context of a language that is compiled JIT. I use Reg-Fre COM because i would like to avoid having to register my COM component and would like this application to be installable without administrative rights.
The JIT compiler is the main executable is signed and contains an embeded manifest. Latest versions of Windows prefer the embeded manifest over an external one, by default (it was the opposite on Windows XP).
Since the JIT is signed, i cannot extract/modify/update it's manifest without breaking the signing. Also, this would introduce complexity in the maintenance of our application (always making sure we embed a new manifest). And there's are also the legal implications of modifying a program for which i don't own the rights.
So, my idea was to try to get the WinSxS activation going thru a Win32 wrapper library for which i would provide a manifest that lists the dependencies. As a proof of concept, i decided to make a simple VB6 app, a C++ Wrapper Library and two COM library (1 in .NET and 1 in VB6).
The wrapper contains 3 methods, one that calls the VB6 COM, one that calls the .NET COM and one that returns a simple string.
As long as everything as my COM are registered, it works, of course.
If i unregister them, provide manifests for the COMs and add them as dependencies to the main executable's manifest, it works.
If i unregister them, provide manifests for the COMs and the C++ Wrapper and add the com as dependencies for the C++ Wrapper and then add the C++ Wrapper as the only dependency in the main executable's manifest, it works.
If i delete my main executable's manifest, the COM calls stop working but the simple string method still works.
Please note that for all my tests, i run a Powershell script that changes the Modified Date of all my files, making sure to trip the activation context cache (manifest).
From there, i started debugging using SXSTrace.exe and setting the COMPlus_LoadLogDir variable. I found out that if my manifest is external, it never gets taken into consideration. I also found out that if i embed it in the .DLL, sxstrace shows it is found, parsed and that the dependencies are found, their manifest found and i get the usual successful context activation lines in the log.
INFO: Parsing Manifest File C:\RegFreeComWrapper\bin\vbCom.MANIFEST.
INFO: Manifest Definition Identity is vbCom,type="win32",version="1.0.0.0".
INFO: Parsing Manifest File C:\RegFreeComWrapper\bin\netCom.MANIFEST.
INFO: Manifest Definition Identity is netCom,processorArchitecture="msil",version="1.0.0.0".
INFO: Activation Context generation succeeded.
End Activation Context Generation.
However, even tho the log says that, my COM calls still dont go thru.
When the call goes thru for the .NET COM call, i get some output in the COMPlus_CLRLoadLogDir configured path.
In this case, i don't get any output.
As soon as i add the manifest that only lists my C++ Wrapper as a dependency to my main executable, everything starts working again. I get a similar output from SXSTrace, but now the COM call works. As mentioned, in all cases, the C++ Wrapper's simple string method works. Meaning that even tho i have no manifest from my main executable, it can still find my .dll and call it.
Seems like the COMs don't work if i dont have the full manifest chain:
Application.Manifest > Wrapper.Manifest > COMs manifests
So, two things here...
1. Is the thing i'm trying to do even possible? (Having dependencies listed only in the manifest of a DLL that belongs to me, without touching the main executable's manifest)
2. If it is possible, i'm probably only missing a small thing to get everything going... what is it ? :)
I can provide all my code/executable as examples, should someone be interested in trying stuff with em.
Got it working!
I modified my C++ Wrapper to use the Activation Context API and force a context activation using 'ActivateActCtx'
http://msdn.microsoft.com/en-us/library/aa374151(v=vs.85).aspx
I wrapped my code with their example's code and made sure to reference my manifests and now all is working fine. No manifest on my main executable!

In a webapp GUI builder throws error message

I have a very complex user interface constructed using the GUI builder.
All was working as promised until I added 8 more severside functions to the code.
In the GUI Builder (when I try to attach these new functions to mouse up, The GUI Builder announces "An Unexpected Error occured" in a pink stripe across the top of the script editor.
When I clear the error, the project appears to be OK and I can save and run the application.
If I go to any previously object that triggers a server side handler and attempt to change it I get the same error.
It is my suspicion that the failure happens when the GUI builder tries to load the list of available functions from the code source. My code is running upwards of 50 Gscript functions.
If there are some limits on what the GUI Builder can handle it would be really nice to have those documented. Also a more meaningful error message would be nice.
I assume that I can still add/attach these handlers in the code base (outside of GUI Builder)?
This error message comes up when you try to getElementById using an Id that doesn't exist. Please check all the widget Ids in your GUI.I'm pretty sure your issue is not related to some systemic limitation, I've made some complex UIs with the GUI builder without issue.
you d better use a full scripted apps instead of GUI..I gave up with GUI since there is some strange stuff..as ID managment, name managment, radio button (bug as well in normal scripting..^^)..GUI is a black box for me..just try to make your app with vertical horizontal or xy panel...and you will be able to know who do wa and when... with the logger

How can I get Hudson to continue a build after a windows command fails?

I've got a build script from a 3rd party tool. It does it's job properly, but throws a useless exception at the end which I need to ignore.
But Hudson doesn't ignore it. It stops my build when this script exits with an error code != 0. Which it does, even when the last line is 'exit 0'.
There is no option in the Hudson build configuration to specify how to treat failure of a particular build step.
Is there a hidden option to tell Hudson to soldier on? Where is the general reference for Hudson's config.xml?
On Unix systems, one way around the problem is to run it in a sub shell of bash, with an "exit 0" as the final command. For example:
bash -c "false; exit 0"
This will run "false" but will have a return value of 0.
This is a little hacky but does work. I do not know if a similar solution exists for windows.
One of Hudson's key properties is that everything can be configured via the web interface. So looking at the config.xml is not the right approach.
In Hudson, your windows command can be launched via a batch file. I suggest looking into making that batch file return a zero error code, regardless of what your third party tool does. The first line would invoke your tool, and the second line would be 'exit 0'
Seems that one has to wrap the offending script in it's own bat:
copy con wrapper.bat
>myErrorMakingScript.bat
>exit /b 0
and then fire wrapper.bat from Hudson.
Use the Join trigger Plugin
work great for me.
check the "Trigger even if some downstream projects are unstable" option