Hello
I'm using CADImport.dll for making a CAM system and I have a problem with manipulation of entities.
One tipical scenario is with selection of an entity , for example :
1) I'm opening a dwg file , then I'm iterating over all entities in CADImage.Converter.Entities and adding them to a ListControl(as tags to each ListItem).
2)Then When I click on item , I'm getting the assigned entity and trying to set its Selected property to true. Actually after invoking this the entity is selected but this not appear on the cadImage.Interesting thing here is that if I invoke CADEntity.Selected = true , during the load iteration (look at point 1), then everithing is OK!
Also when I click on list item and set CADEntity.Selected = true and then print the cadImage , this entity appears correctly (as selected ) on the paper!
The same situation appears when I'm trying to change color of an entity.
Please help me, what I'm doing wrong.
Best Regards
Miroslav
Manipulating CADENtities
Moderators: SDS, support, admin
Re: Manipulating CADENtities
Hello.
Just invalidate the control for the CADImage object after any such manipulations over the entities.
Alexander.
Just invalidate the control for the CADImage object after any such manipulations over the entities.
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: Manipulating CADENtities
Hi Alexander
Thank you for your replay.
Yes I'm invalidating the CADPictoreBox after each manipulation , but this doesn't help.
I'm using the following code:
1) Loading the entities:
private void LoadEntities()
{
CADEntityCollection entities = mCadImage.Converter.Entities;
TreeNode root = mTreeView.Nodes["mRootNode"];
TreeNode cutterNode = root.Nodes["mCutterNode"];
cutterNode.Nodes.Clear();
TreeNode lighterNode = root.Nodes["mLighterNode"];
lighterNode.Nodes.Clear();
TreeNode penNode = root.Nodes["mPenNode"];
penNode.Nodes.Clear();
TreeNode creaseNode = root.Nodes["mCreaseNode"];
creaseNode.Nodes.Clear();
TreeNode unknownNode = root.Nodes["mUnnknowNode"];
unknownNode.Nodes.Clear();
foreach (string key in entities.AllKeys)
{
CADEntity t = (CADEntity)entities[key];
int argb = t.Color.ToArgb();
string name = t.EntName;
TreeNode newNode = new TreeNode(name);
newNode.Tag = t;
if (argb == Color.Red.ToArgb())
{
cutterNode.Nodes.Add(newNode);
continue;
}
if (argb == Color.Green.ToArgb())
{
creaseNode.Nodes.Add(newNode);
continue;
}
if (argb == Color.Yellow.ToArgb())
{
lighterNode.Nodes.Add(newNode);
continue;
}
if (argb == Color.Blue.ToArgb())
{
penNode.Nodes.Add(newNode);
continue;
}
unknownNode.Nodes.Add(newNode);
t.Color = Color.Cyan;
}
}
2 Clicking on node:
private void mTreeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
CADEntity ent = e.Node.Tag as CADEntity;
if (ent == null)
{
return;
}
ent.Color = Color.Brown;
mCadPictureBox.Invalidate();
}
AS You see in the method (1) I'm also changing the color and then everithing is working well --> " t.Color = Color.Cyan;"
but in the method (2) changing of the color is not working. As you see here I'm invalidating the control of the cad image.
I really don't understand where is the problem , it should be working fine.
Best Regards
Miroslav
Thank you for your replay.
Yes I'm invalidating the CADPictoreBox after each manipulation , but this doesn't help.
I'm using the following code:
1) Loading the entities:
private void LoadEntities()
{
CADEntityCollection entities = mCadImage.Converter.Entities;
TreeNode root = mTreeView.Nodes["mRootNode"];
TreeNode cutterNode = root.Nodes["mCutterNode"];
cutterNode.Nodes.Clear();
TreeNode lighterNode = root.Nodes["mLighterNode"];
lighterNode.Nodes.Clear();
TreeNode penNode = root.Nodes["mPenNode"];
penNode.Nodes.Clear();
TreeNode creaseNode = root.Nodes["mCreaseNode"];
creaseNode.Nodes.Clear();
TreeNode unknownNode = root.Nodes["mUnnknowNode"];
unknownNode.Nodes.Clear();
foreach (string key in entities.AllKeys)
{
CADEntity t = (CADEntity)entities[key];
int argb = t.Color.ToArgb();
string name = t.EntName;
TreeNode newNode = new TreeNode(name);
newNode.Tag = t;
if (argb == Color.Red.ToArgb())
{
cutterNode.Nodes.Add(newNode);
continue;
}
if (argb == Color.Green.ToArgb())
{
creaseNode.Nodes.Add(newNode);
continue;
}
if (argb == Color.Yellow.ToArgb())
{
lighterNode.Nodes.Add(newNode);
continue;
}
if (argb == Color.Blue.ToArgb())
{
penNode.Nodes.Add(newNode);
continue;
}
unknownNode.Nodes.Add(newNode);
t.Color = Color.Cyan;
}
}
2 Clicking on node:
private void mTreeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
CADEntity ent = e.Node.Tag as CADEntity;
if (ent == null)
{
return;
}
ent.Color = Color.Brown;
mCadPictureBox.Invalidate();
}
AS You see in the method (1) I'm also changing the color and then everithing is working well --> " t.Color = Color.Cyan;"
but in the method (2) changing of the color is not working. As you see here I'm invalidating the control of the cad image.
I really don't understand where is the problem , it should be working fine.
Best Regards
Miroslav
Re: Manipulating CADENtities
That's really strange because your code sample 2 works well if implemented into one of standard demo applications. Also which library version you use? Please try current release version 7.2.6.
Alexander.
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: Manipulating CADENtities
Hi Alexandersupport wrote:That's really strange because your code sample 2 works well if implemented into one of standard demo applications. Also which library version you use? Please try current release version 7.2.6.
Alexander.
I'm using CADImport.dll 6.3.2942.31653 extended version.
Please provide me location where to download 7.2.6 extended version.If you preffer you can send me this location via mail miroslav.goranov@abv.bg.
Does this new version work with the same registration data (key,name and mail address) ?
Best Regards
Miroslav
Re: Manipulating CADENtities
Hello Miroslav.
CAD Import 6 doesn't supported anymore. Versoin 7 have different registration data. I can suggest purchasing upgrade. I will write in details to your mailbox.
Alexander.
CAD Import 6 doesn't supported anymore. Versoin 7 have different registration data. I can suggest purchasing upgrade. I will write in details to your mailbox.
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support