CADEditorControl SHOW JPG

Discuss and ask questions about CAD DLL (CAD Image DLL, CAD Importer DLL).

Moderators: SDS, support, admin

Post Reply
windsu
Posts: 2
Joined: 14 Nov 2022, 05:35

CADEditorControl SHOW JPG

Post by windsu » 14 Nov 2022, 05:53

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

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Re: CADEditorControl SHOW JPG

Post by support » 14 Nov 2022, 13:39

windsu wrote:
14 Nov 2022, 05:53
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
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.

Image
Best wishes,
Catherine.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

windsu
Posts: 2
Joined: 14 Nov 2022, 05:35

Re: CADEditorControl SHOW JPG

Post by windsu » 15 Nov 2022, 03:49

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?

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Re: CADEditorControl SHOW JPG

Post by support » 15 Nov 2022, 11:15

windsu wrote:
15 Nov 2022, 03:49
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?

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.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply