I am testing out the example code for coloring a surface using ISWColorContour1 http://help.solidworks.com/2017/english/api/swpublishedapi/Custom_Colorize_a_Model_Example_CSharp.htm .
I'm running on SW2018. When I call the line
modExt.InstallModelColorizer(colorInt);
I get the following exception. So far I haven't found any info as to what could be happening. Any ideas?
{"Specified cast is not valid."}
Data: {System.Collections.ListDictionaryInternal}
HResult: -2147467262 HelpLink: null IPForWatsonBuckets: {140703376164576} InnerException: null IsTransient: false Message: "Specified cast is not valid."
RemoteStackTrace: null Source: "mscorlib" StackTrace:
" at System.StubHelpers.InterfaceMarshaler.ConvertToNative(Object objSrc, IntPtr itfMT, IntPtr classMT, Int32 flags)
at SolidWorks.Interop.sldworks.ModelDocExtensionClass.InstallModelColorizer(Object PInterface)