.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Grips on .net

10 REPLIES 10
Reply
Message 1 of 11
danny.boy.1
1097 Views, 10 Replies

Grips on .net

Hello

Please if someone knows something about this.

Can we disable grips to be unvisible for certain autocad drawing objects?

line and (or) text...etc

Best regards
Danijel Ivankovic
10 REPLIES 10
Message 2 of 11
Anonymous
in reply to: danny.boy.1

In AutoCAD 2010, you can derive a class from GripOverrule to
prevent grips from appearing on certain objects.

Just override both of the GetGripPoints() methods and do not
call base.GetGripPoints().

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");


wrote in message news:6202209@discussion.autodesk.com...
Hello Please if someone knows something about this. Can we disable grips to
be unvisible for certain autocad drawing objects? line and (or) text...etc
Best regards Danijel Ivankovic
Message 3 of 11
Brunoneves1
in reply to: danny.boy.1

Hi Tony.

First I want to tell you that I admire you a lot. You are the best autocad programmer I have ever seen.

Second , a simple question: How can I get the grippoints of a entity in dotnet ?

I have tried the following:

Point3dCollection GetGripPoints(Entity en)
{
Point3dCollection pts = new Point3dCollection();
IntegerCollection ic1 = new IntegerCollection(),
ic2 = new IntegerCollection();
en.GetGripPoints(pts, ic1, ic2);
return pts;
}

but I have got the error message: "Value cannot be null".

I used to do this in old c++ ObjectArx and never got any problem.

Thanks in advance.
Message 4 of 11
Anonymous
in reply to: danny.boy.1

Thanks, there's lots of programmers out there that are better
at this stuff than I am - most are just too busy to routinely post
here.

I remember this coming up in the past, and there was the
requirement that one of the the integer collections cannot
be empty.

Try adding 0 to the geometryId's collection, and see if that
works.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");


wrote in message news:6202386@discussion.autodesk.com...
Hi Tony. First I want to tell you that I admire you a lot. You are the best
autocad programmer I have ever seen. Second , a simple question: How can I
get the grippoints of a entity in dotnet ? I have tried the following:
Point3dCollection GetGripPoints(Entity en) { Point3dCollection pts = new
Point3dCollection(); IntegerCollection ic1 = new IntegerCollection(), ic2 =
new IntegerCollection(); en.GetGripPoints(pts, ic1, ic2); return pts; } but
I have got the error message: "Value cannot be null". I used to do this in
old c++ ObjectArx and never got any problem. Thanks in advance.
Message 5 of 11
Brunoneves1
in reply to: danny.boy.1

Hi again. Tony.

Well, it didnt work. Here is the code:

Point3dCollection GetGripPoints(Entity en)
{
Point3dCollection pts = new Point3dCollection();
IntegerCollection ic1 = new IntegerCollection(),
ic2 = new IntegerCollection();
ic2.Add(0);
en.GetGripPoints(pts, ic1, ic2);
return pts;
}

My test project is attached.

I had ask this question in this group before, as you told, but without answer. I was in another user name, but I have changed it because I lost my password (this is the third time);

In my project, I need to get the grippoints of regions and solids, and I'm doing a stupid thing to solve this problem: Exploding then, and getting the starts and endpoints of the resilting curves.

Thanks agains Tony.
Message 6 of 11
Anonymous
in reply to: danny.boy.1

This is a result of a bug in Autodesk's API, and if you read
back into this newsgroup, you'll find that it also affects the
GetObjectSnapPoints() method as well.

The workaround is to call the overload of the IntegerCollection's
constructor that takes the initial capacity, and pass it a non-zero
value:

IntegerCollection ic1 = new IntegerCollection(1);
IntegerCollection ic2 = new IntegerCollection(1);

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");


wrote in message news:6202794@discussion.autodesk.com...
Hi again. Tony. Well, it didnt work. Here is the code: Point3dCollection
GetGripPoints(Entity en) { Point3dCollection pts = new Point3dCollection();
IntegerCollection ic1 = new IntegerCollection(), ic2 = new
IntegerCollection(); ic2.Add(0); en.GetGripPoints(pts, ic1, ic2); return
pts; } My test project is attached. I had ask this question in this group
before, as you told, but without answer. I was in another user name, but I
have changed it because I lost my password (this is the third time); In my
project, I need to get the grippoints of regions and solids, and I'm doing a
stupid thing to solve this problem: Exploding then, and getting the starts
and endpoints of the resilting curves. Thanks agains Tony.
Message 7 of 11
Brunoneves1
in reply to: danny.boy.1

It Worked!!! Thanks so much, Tonny !!!

Interesting. I had to add a zero in the snapmodes AND in the geometryIds. But the key is really in the constructor.

Here is the code that worked.

Point3dCollection GetGripPoints(Entity en)
{
Point3dCollection pts = new Point3dCollection();
IntegerCollection snapModes = new IntegerCollection(1),
geometryIds = new IntegerCollection(1);

snapModes.Add(0);
geometryIds.Add(0);
en.GetGripPoints(pts, snapModes, geometryIds);

return pts;
}



Edited by: Brunoneves1 on Jun 17, 2009 1:07 PM Edited by: Brunoneves1 on Jun 17, 2009 1:09 PM
Message 8 of 11
danny.boy.1
in reply to: danny.boy.1

Tony thank you very much!
Message 9 of 11
johnds
in reply to: danny.boy.1

Hi trhere,

Just a word of warning, the code you posted above does not always work. Trust me, I have been trying it on MOST of the acad entity types, and the number of grip points varies from entity to entity, in comparison to what you see when you actually SELECT the entity.

In other words, when you select the entity, thn number of grips points you see in the editor (though sometimes there are overlapping grips, like in the case of Swept entities), should be the same number of points returned by the GetGripPoints method.

Try it, it differs particularly with splines and all the mesh objects. But splines the method will usually return 2 points, when it will actually have more.

John.
Message 10 of 11
Anonymous
in reply to: danny.boy.1

surely sometimes it's not works good, eg.when you select one lwpolyline just with two vertexs. the CAD crashed.
Message 11 of 11
achinta
in reply to: danny.boy.1

Hi,

 

  

I am developing simmilar thing. in c++

 

 

Acad::ErrorStatus MyGripOverrule::getGripPoints(const AcDbEntity* pSubject,
                                                    AcDbGripDataPtrArray& grips,
                                                    const double curViewUnitSize,
                                                    const int gripSize,
                                                    const AcGeVector3d& curViewDir,
             const int bitflags)
{
 //assertReadEnabled();
 AcDbGripOverrule::getGripPoints(pSubject, grips, curViewUnitSize, gripSize, curViewDir, bitflags);
 AcDbGripData* p_gp = new AcDbGripData();
 AcGePoint3d pt;

 pt = ((CMyCircle*)pSubject)->center();
 p_gp->setAppData((void*)100);
 pt.x += ((CMyCircle*)pSubject)->radius() / 2.0;
 p_gp->setGripPoint(pt);
  grips.append(p_gp);
 return Acad::eOk;
}

 

where MyGripOverrule is derived from AcDbGripOverrule.

 

when I create and select the entity, the new grip point apprears.

But when I move any grip point or deselect the entity, then it get crashed. (allocate and free has problem)

when I comment   

grips.append(p_gp);

new grip point not get created but application don't get crash.

Problem is related to applocation and de applocation of the AcDbGripData. but I am not able to solve the problem.

 

Need help on same.

 

regards

 

Achinta

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost