I'm inspecting the draft objects(DraftDocument, DrawingView etc) searching for a property or method to insert an image to a draft, like in the picture bellow(selected in pink).
I know it's ought to be simple, but I looked at documentation and Solid Edge Spy, and I couldn't find it.
Does anybody know the code that does that?
Solved! Go to Solution.
I did the opposit, I had to search for an image and had to delete it. Its quite hidden:
To add a new one, you presumably can use (note the plural):
var image = FrameworkSupport.SmartFrames2d.AddBy2Points(StyleN
and then modify the options of the SmartFrame2d object.
Hope that helps
Hi, Freijon. Thanks for your response!
I'm having a litle problem with this code. VS complains that an object reference is needed to call the method AddBy2Points as you can see bellow:
When I try to create the object it says that I can't create an instance of this abstract class or interface:
It seems not to make sense creating a custom class that supports this interface and implement this method so that I could instanciate an object and call it.
Sorry if I'm missing something really silly right under my nose.
Any ideas about how I can use the method SmartFrames2d.AddBy2Points() to create a SmartFrame?
Sorry, my code was supposed to be dummy code to explain the situation. What you will have to do is the following (in C# but I'm sure you can translate it yourself):
DraftDocument dft = null;
Sheet sheet = null;
SmartFrames2d sfs2d = null;
SmartFrame2d image = null;
dft = (DraftDocument)app.ActiveDocument; //"app" is the Application object
sheet = (Sheet)dft.ActiveSheet;
sfs2d = (SmartFrames2d)sheet.SmartFrames2d;
image = (SmartFrame2d)sfs2d.AddBy2Points("", 0.5, 1.0, 1.0, 1.5);
Haven't tested the code, but it should work IMO.
Thanks for you code. It really shows the SmartFrame2d, but displaying only the name of the image, as you can see bellow:
I left the Style parameter blank(image = (SolidEdgeFrameworkSupport.SmartFrame2d)sfs2d.AddB
I don't know if it's causing the issue. I'm investiganting the SmartFrame2dDefault(s) and SmartFrame2dStyle(s), but wiht no success until now. If I have any news I'll post here.
I finally did it! It's similar to your solution! The sheet class has an image2D object.
SolidEdgeFrameworkSupport.Images2d imgs = null; SolidEdgeFrameworkSupport.Image2d img = null; imgs = sheet.Images2d; img = imgs.AddImage(true, @"C:\Detail.png"); img.Update();
Thanks a lot for your help!