How to add a block in a CADImage ?

Discuss and ask questions about CADViewX (Lite and Pro versions).

Moderators: SDS, support, admin

Post Reply
xavier
Posts: 27
Joined: 04 Dec 2012, 14:58

How to add a block in a CADImage ?

Post by xavier » 07 Dec 2012, 18:00

Hello

I found out how added a circle in a CADImage:

ActiveX_Point = new Automation object "CADViewLib.Point3D"
ActiveX_Cercle = new Automation object "CADViewLib.Circle"
Plan_ActiveX = new Automation object "CADViewLib.CADViewX"

ActiveX_Point >> x = 0
ActiveX_Point >> y = 0
ActiveX_Point >> z = 0

ActiveX_Cercle >> Radius = 5
ActiveX_Cercle >> Point = ActiveX_Point
ActiveX_Cercle >> Color = in_Color
Plan_ActiveX >> CADImage >> Converter >> Loads (ActiveX_Cercle)

Plan_ActiveX >> CADImage >> CurrentLayout >> addEntity (ActiveX_Cercle)
Plan_ActiveX >> >> CADImage RefreshCurrentLayout ()

But I can not add a block in a CADImage. How should I do?
For example, how do we add a block of two concentric circles?

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

Re: How to add a block in a CADImage ?

Post by support » 19 Dec 2012, 18:29

Hello.
Block is not a visible entity on drawing but object that can contain entities. The code to add a block reference (Insert entity) is the similar to adding single entity. Block name must be specified to successfully add a block reference to a drawing. However the current library version restricts the Block.Name property as read only. We will change the property access. Editor can be used to add a block in current CADViewX version:

Code: Select all

            CADViewLib.Group concentric = new CADViewLib.Group();

            CADViewLib.Circle mCircle = new CADViewLib.Circle();
            mCircle.Point = CADViewX1.MkFPoint(100, 100, 0);
            mCircle.Radius = 100;
            CADViewX1.CADImage.Converter.Loads((CADViewLib.Entity)mCircle);
            concentric.AddEntity((CADViewLib.Entity)mCircle);

            mCircle = new CADViewLib.Circle();
            mCircle.Point = CADViewX1.MkFPoint(100, 100, 0);
            mCircle.Radius = 70;
            CADViewX1.CADImage.Converter.Loads((CADViewLib.Entity)mCircle);
            concentric.AddEntity((CADViewLib.Entity)mCircle);

            Editor.Select((CADViewLib.Entity)concentric);
            Editor.Copy();
            Editor.PasteAsBlock();
            Editor.PasteAtPoint(CADViewX1.MkFPoint(200, 200, 0));
            Editor.Clear();
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

xavier
Posts: 27
Joined: 04 Dec 2012, 14:58

Re: How to add a block in a CADImage ?

Post by xavier » 03 Jan 2013, 13:39

hello

" ... However the Ellipse.RadPt property that defines the relative end point of ellipse major axis have read-only modifier. Because of this created ellipse will be not correct. We will fix this problem."
Alexander

" ... Name property as read only. We will change the property access."
Alexander




An idea of ​​the release date of the next revision of CADViewX?

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

Re: How to add a block in a CADImage ?

Post by support » 09 Jan 2013, 19:11

Hello Xavier.
Unfortunately we can't provide a date of release of the CADViewX version with the mentioned corrections. Please inform us if you have any other remarks on the library.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

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

Re: How to add a block in a CADImage ?

Post by support » 14 Jan 2013, 19:01

Hello Xavier.
We have implemented necessary modifications to the library. A name can be set to a block and the following code can be used to create a block with entities:

Code: Select all

    CADViewLib.Block cxBlc = new CADViewLib.Block();
    cxBlc.Name = "Concentric_circles";
    CADViewX1.CADImage.Converter.get_Sections(CADViewLib.TxConvSection.csBlocks).AddEntity((CADViewLib.Entity)cxBlc);

    CADViewLib.Circle mCircle = new CADViewLib.Circle();
    mCircle.Point = CADViewX1.MkFPoint(100, 100, 0);
    mCircle.Radius = 100;
    CADViewX1.CADImage.Converter.Loads((CADViewLib.Entity)mCircle);
    cxBlc.AddEntity((CADViewLib.Entity)mCircle);

    mCircle = new CADViewLib.Circle();
    mCircle.Point = CADViewX1.MkFPoint(100, 100, 0);
    mCircle.Radius = 70;
    CADViewX1.CADImage.Converter.Loads((CADViewLib.Entity)mCircle);
    cxBlc.AddEntity((CADViewLib.Entity)mCircle);

    CADViewX1.CADImage.Converter.Loads((CADViewLib.Entity)cxBlc);

    CADViewLib.Insert cxIns = new CADViewLib.Insert();
    cxIns.Block = cxBlc;
    cxIns.Point = CADViewX1.MkFPoint(150, 150, 0);
    CADViewX1.CADImage.Converter.Loads((CADViewLib.Entity)cxIns);
    CADViewX1.CADImage.CurrentLayout.AddEntity((CADViewLib.Entity)cxIns);

    CADViewX1.CADImage.RefreshCurrentLayout();
The updated version is available for downloading:
http://www.cadsofttools.com/download/cadviewx.zip

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

xavier
Posts: 27
Joined: 04 Dec 2012, 14:58

Re: How to add a block in a CADImage ?

Post by xavier » 14 Jan 2013, 20:35

Thanks

xavier
Posts: 27
Joined: 04 Dec 2012, 14:58

Re: How to add a block in a CADImage ?

Post by xavier » 16 Jan 2013, 11:58

Hello

I tested the code in c #.

I thought the line of code "cxIns.Point CADViewX1.MkFPoint = (150, 150, 0);" allowed to indicate the coordinates of the block insertion.

But whatever the chosen coordinates, the block always appears in the same place.
I tested with (0,0,0) then I tested with (150,150,0), the block is in the same place.
Some coordinates even cause irreparable failures.

is this normal? have I misunderstood the functionality of the "cxIns.Point" property ?

Cordially

Xavier

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

Re: How to add a block in a CADImage ?

Post by support » 21 Jan 2013, 13:20

Hello Xavier.
The Point property defines placement of an Insert on the drawing. Location of an Insert at (0, 0, 0) while Insert.Point have different values is incorrect. We have fixed this problem and updated the library:
http://www.cadsofttools.com/download/cadviewx.zip

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

xavier
Posts: 27
Joined: 04 Dec 2012, 14:58

Re: How to add a block in a CADImage ?

Post by xavier » 21 Jan 2013, 14:06

thanks

it works.

good day

Post Reply