Page 1 of 1
CADEditorControl SHOW JPG
Posted: 14 Nov 2022, 05:53
by windsu
I USE CADEditorControl
BUT PNG CAN'T SHOW
IF I USE AUTOCAD THE FILE LINE IN D:\CTEWORK\HOUJPG\XXX.JPG
HOW DO? CAN USE CADEditorControl SHOW THIS JPG?
http://matsap.cte.com.tw:405/CADTemp/p1.png
Re: CADEditorControl SHOW JPG
Posted: 14 Nov 2022, 13:39
by support
Hi,
First, I'd like to note that CADEditorControl is available in CAD .NET only, CAD DLL doesn't have such control.
As for the issue with displaying PNG or JPG files. Please, check the path to the required picture. Reference pictures are class instances of
CADImageEnt class. While debugging and after you open a file in the demo project, you should have a look at
cadImafe.Converter.Entities , and look through required
CADImageEnt. This entity has
ImageDef property with
FileName property in it, which is used to specify the path to the picture.

Best wishes,
Catherine.
Re: CADEditorControl SHOW JPG
Posted: 15 Nov 2022, 03:49
by windsu
OK ,thanks
but My jpg/png in autocad use line find file
http://matsap.cte.com.tw:730/CADTemp/p2.png
how use cad CADImageEnt?
Re: CADEditorControl SHOW JPG
Posted: 15 Nov 2022, 11:15
by support
Hi,
Please, have a look at the example below on how to add CADImageEnt (this code example is available in the
AddEntities demo of CAD .NET):
Code: Select all
private void AddImageEnt()
{
string fileName = cnstImagePath;
if (!File.Exists(fileName))
{
fileName = cnstAddonPath + fileName;
if (!File.Exists(fileName))
return;
}
CADImageDef vImageDef = new CADImageDef();
vImageDef.FileName = fileName;
if (new Bitmap(vImageDef.FileName) != null)
{
AddEntToSection(ConvSection.ImageDefs, vImageDef);
CADImageEnt vImageEnt = new CADImageEnt();
vImageEnt.ImageDef = vImageDef;
vImageEnt.Point = new DPoint(370, -160, 0);
vImageEnt.UVector = CADConst.XOrtAxis;
vImageEnt.VVector = CADConst.YOrtAxis;
vImageEnt.Size = vImageEnt.ImageDef.Size;
vImageEnt.Width = 59;
if (!PlaceEntity(vImageEnt))
this.cadImage.Converter.ImageDefs.Remove(vImageDef);
imgEntHandle = vImageEnt.Handle;
}
}
private void AddEntToSection(ConvSection aSection, CADEntity aEntity)
{
this.cadImage.Converter.Loads(aEntity);
this.cadImage.Converter.GetSection(aSection).AddEntity(aEntity);
}
private bool PlaceEntity(CADEntity aEntity)
{
return PlaceEntity(aEntity, "");
}
private bool PlaceEntity(CADEntity aEntity, string aLayoutName)
{
CADLayout vLayout;
if (aLayoutName == "")
vLayout = this.cadImage.Layouts[0];
else
vLayout = this.cadImage.Converter.LayoutByName(aLayoutName);
if (vLayout == null) return false;
this.cadImage.Converter.Loads(aEntity);
vLayout.AddEntity(aEntity);
return true;
}
As for the sent pricture. Unfortunately, I couldn't open the link, it seems to be damaged.