How Can I Move Objects

How Can I Move Objects

Anonymous
Not applicable
876 Views
10 Replies
Message 1 of 11

How Can I Move Objects

Anonymous
Not applicable
Hi.

I Have AcDbEntity and i want to move it to specific point, How ???

Thanks A Lot For Helping.
0 Likes
877 Views
10 Replies
Replies (10)
Message 2 of 11

Anonymous
Not applicable
On Mon, 24 Nov 2003 02:15:36 -0800, Iggo wrote:

> Hi.
>
> I Have AcDbEntity and i want to move it to specific point, How ???
>
AFAIK, you can't 😞

You need to open the entity as the type it is, i.e. AcDbLine, AcDbCircle,
AcDbPolyline, etc... and then each class has it's different way of changing
the insertion point

This is one of the most stupid things that Autodesk has done!

I can't figure out why it is done this way, every entity needs an insertion
point... But now maybe I will know 😉

// Anders
0 Likes
Message 3 of 11

Anonymous
Not applicable
transform(...)
"Iggo"
??????:0A5DD77DBFA0532F43FDB8F641A2DBCF@in.WebX.maYIadrTaRb...
> Hi.
>
> I Have AcDbEntity and i want to move it to specific point, How ???
>
> Thanks A Lot For Helping.
>
>
0 Likes
Message 4 of 11

Anonymous
Not applicable
> AFAIK, you can't 😞
>
> You need to open the entity as the type it is, i.e.
> AcDbLine, AcDbCircle, AcDbPolyline, etc... and then
> each class has it's different way of changing the insertion point

I'm afraid you're mistaken.

You can move any entity using AcDbEntity::transformBy()


--
AcadXTabs: Document Tabs for AutoCAD
http://www.acadxtabs.com
0 Likes
Message 5 of 11

Anonymous
Not applicable
On Mon, 24 Nov 2003 06:36:33 -0800, Tony Tanzillo wrote:

> I'm afraid you're mistaken.

Well, that's no suprise 😉

> You can move any entity using AcDbEntity::transformBy()
Would you Please post an sample!

I don't understand how you can move the entity without knowing it's
insertion point and to know this I must have the actual type, e.g.
AcDbCircle, don't I??

// Anders
0 Likes
Message 6 of 11

Anonymous
Not applicable
You don't need to know how to move any entity, because
each entity knows how to "move" itself, when it is told
to do that, and the only thing you need to tell an entity
is how far and in what direction to move, right?

That's the whole point to "object oriented". Each object
encapsulates the intelligence and logic required to
carry out operations like move, scale, and so forth.

AcGeMatrix3d m;
AcGeVector3d v(2.0, 4.0, 1.0); // X, Y, Z translation
m.setTranslation(v);
AcDbEntity* pEnt = ... // open entity to move
pEnt->transformBy(m);
pEnt->close();

--
AcadXTabs: Document Tabs for AutoCAD
http://www.acadxtabs.com


"Anders Eriksson" wrote in message
news:c3woanirh2ge$.dlg@morateknikutveckling.se...
> On Mon, 24 Nov 2003 06:36:33 -0800, Tony Tanzillo wrote:
>
> > I'm afraid you're mistaken.
>
> Well, that's no suprise 😉
>
> > You can move any entity using AcDbEntity::transformBy()
> Would you Please post an sample!
>
> I don't understand how you can move the entity without knowing it's
> insertion point and to know this I must have the actual type, e.g.
> AcDbCircle, don't I??
>
> // Anders
0 Likes
Message 7 of 11

Anonymous
Not applicable
Hello Tony!

On Tue, 25 Nov 2003 09:43:03 -0800, Tony Tanzillo wrote:

>
> AcGeMatrix3d m;
> AcGeVector3d v(2.0, 4.0, 1.0); // X, Y, Z translation
> m.setTranslation(v);
> AcDbEntity* pEnt = ... // open entity to move
> pEnt->transformBy(m);
> pEnt->close();

Ok, I finally get it! The movement is relative, but what if I need to move
the entity to a specific coordinate?

I just tested your code on a line and it will change both start point and
end point. What if I only want to change the start point?

Thanks for helping!

// Anders
0 Likes
Message 8 of 11

Anonymous
Not applicable
Thanks, Tony.
0 Likes
Message 9 of 11

Anonymous
Not applicable
"Anders Eriksson" wrote

> Ok, I finally get it! The movement is relative, but what if I
> need to move the entity to a specific coordinate?

The movement is still relative. The only difference is how you
determine the displacement.

I think you're missing the point, which is that you originally
suggested that moving an entity requires some specific knowledge
about its type (e.g., its a circle, a line, an arc or so on), and
that you must take different actions depending on the entity type,
and what I was trying to say is that this is not the case.

> I just tested your code on a line and it will change both start point and
> end point. What if I only want to change the start point?

If you only want to change the start point, that is not
'moving' the entity, that's more akin to stretching it,
and that's a different subject 🙂

--
AcadXTabs: Document Tabs for AutoCAD
http://www.acadxtabs.com
0 Likes
Message 10 of 11

Anonymous
Not applicable
On Thu, 27 Nov 2003 13:25:34 -0800, Tony Tanzillo wrote:

> "Anders Eriksson" wrote
>
>> Ok, I finally get it! The movement is relative, but what if I
>> need to move the entity to a specific coordinate?
>
> The movement is still relative. The only difference is how you
> determine the displacement.
>
Which you can't do if you haven't got the entities insertion point and to
get the insertion point you need to know the entity type.

> I think you're missing the point, which is that you originally
> suggested that moving an entity requires some specific knowledge
> about its type (e.g., its a circle, a line, an arc or so on), and
> that you must take different actions depending on the entity type,
> and what I was trying to say is that this is not the case.
>
Yes I see my error and I will update a lot of code using transformBy
instead of testing for all sorts of strange entity types...

> If you only want to change the start point, that is not
> 'moving' the entity, that's more akin to stretching it,
> and that's a different subject 🙂
Yes of cause!

Thank you very much! I have learnt something new and really valuable! I
really love newsgroups!!

// Anders
0 Likes
Message 11 of 11

Anonymous
Not applicable
"Anders Eriksson" skrev i
meddelandet
> Which you can't do if you haven't got the entities insertion point and to
> get the insertion point you need to know the entity type.

Try getting the first grip-point. That would work in many cases.

Good luck,

Henrik Vallgren
www.stream-space.com/links.htm
0 Likes