Chemdraw renderer in Ironpython
Writing a script to allow dynamic changes to a Spotfire Lead Discovery visualization. I want to allow the change of the label content and it's associated renderer using a control in a text area. I can code the change to a text label:
vis.SetLabelRenderer(ValueRendererTypeIdentifiers.DefaultRenderer)
But cannot set it back to a structure label as the ValueRendererTypeIdentifier is not given anywhere that I can find.
Is there Lead Discovery specific documentation for scripting?
-
You can test the piece of code that will automatically configure all renderings.
Script (Line of Code):
tableVis.AutoConfigure()Link for reference:
https://docs.tibco.com/pub/doc_remote/sfire_dev/area/doc/api/TIB_sfire-analyst_api/html/M_Spotfire_Dxp_Application_Visuals_VisualContent_AutoConfigure.htmHope this helps!
0 -
Interesting discussion! It seems like navigating the scripting for Lead Discovery can feel a bit like iq test - challenging yet rewarding. Any chance there's specific documentation that could help clarify the use of ValueRendererTypeIdentifiers?
0 -
In your Spotfire ironPython script add the following code:
import clr
clr.AddReference("PerkinElmer.LeadDiscovery.StructureRender")
#clr.AddReferenceToFileAndPath("C:/Users/tencate/AppData/Local/TIBCO/Spotfire/10.10.3/Modules/Lead Discovery_8.6.0.477/PerkinElmer.LeadDiscovery.StructureRender.dll")
#from PerkinElmer.LeadDiscovery.StructureRender import StructureColumnRendererModel
from PerkinElmer.LeadDiscovery.StructureRender import *to be able to set either
myVis.SetLabelRenderer(ChemDrawRendererIdentifiers.ChemDrawRenderer)
myVis.SetLabelRenderer(ChemDrawRendererIdentifiers.ChemDrawRendererVNext)In order to be able to tell Spotfire where to find required information we need to better understand the references added.
Spotfire loads the extensions that contain the .dll files and adds them internally to the .NET environment. (I'm not a dev but that is what I believe how it works).For this reason we are able to reference the same from the namespace pointers and we can comment out the AddFileReference, as when you have a newer version this will require updates.
The Lead Discovery modules and .dll files are under the package folder indicated below.
I used the program ILSpy to look into the definitions from the StructureRenderer
References come out of this contextThe selected node contains the pointers needed for Spotfire to determine the default or vNext
public class ChemDrawRendererIdentifiers : CustomTypeIdentifiers
{
public static readonly CustomTypeIdentifier ChemDrawRenderer = CustomTypeIdentifiers.CreateTypeIdentifier("ChemDrawRenderer", "ChemDraw", string.Format(Resources.RendererDescription, "ChemDraw"));
public static readonly CustomTypeIdentifier ChemDrawRendererVNext = CustomTypeIdentifiers.CreateTypeIdentifier("ChemDrawRendererVNext", "ChemDraw (vNext)", string.Format(Resources.RendererDescription, "ChemDraw (vNext)"));
}2024-11-28: updated with more context
0 -
Gerco ten Kate Can you please provide a link to the references?
0 -
Natalie Coe I updated my post to reflect more on how to get the reference.
0 -
Thank you! Saved me!
0 -
It’s interesting to see the integration of ChemDraw rendering with IronPython being discussed here. For those of us exploring similar workflows, it's always great to learn from shared experiences and troubleshooting tips. I'm curious, have you encountered any specific challenges when scaling this solution for more complex structures or datasets?
0 -
Great insights, Kevin! It seems like navigating the scripting options in Lead Discovery can be a bit of a puzzle—almost like a quick iq test! Have you checked the official documentation or forums for any hidden gems on the ValueRendererTypeIdentifier?
0
Please sign in to leave a comment.
Comments
8 comments