Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ObjectArx: insert block location

0 views
Skip to first unread message

Tony Tanzillo

unread,
Oct 9, 2000, 3:00:00 AM10/9/00
to
I'm not really clear about what you're trying to do.

Are you trying to insert a block from another drawing
into the current drawing (e.g., so that the block exists
in the current draiwng)? And then create an insertion
of the block in the target drawing?

Or, are you just trying to insert entities from another
drawing into the current drawing?

In any event, if it is the latter then the AcGeMatrix3d
parameter determines the position, scale, and orientation
of the resulting entities in the target's model space.

Use the Tra

PSI_Mike wrote:
>
> Sorry about the double post on this topic, I must have
> hit the post button twice by mistake. Anyway, I am trying
> my best to get an insert function to work for some drawings
> that I would like to be inserted by user selected values.
> I looked up the AcDbDatabase::wblock() function before
> I came on here just to be sure and this is what I got
> from the help files:
> wblock(
> AcDbDatabase*& pOutputDb,
> const AcDbObjectIdArray& outObjIds,
>
> const AcGePoint3d& basePoint);
>
> pOutputDb Returns pointer to the database that was written to
> outObjIds Input array of objectId entities of all objects to be wblocked out
> basePoint Inout base point (in WCS coordinates for pOutputDb) to be used in pOutputDb
>
> Now it is the basePoint part that interests me most. I tried
> to set a value for this and the block is still being inserted where it was drawn. In
> other words, lets say the file that I want to insert is just a line. The mid-point of
> that line being at 0,0,0. After I call this function, no matter what I specify for the
> basePoint the drawing is still inserted at the point 0,0,0. I don't understand. Why have
> the argument in the function if it doesn't actually do anything to the function. Anyway,
> here is a part of the code I am trying to write. Could someone please tell me what I am
> doing wrong?
> AcGePoint3d insPoint(1000,1000,0);
>
> AcDbDatabase *pTempDb;
> if (Acad::eOk != extDatabase.wblock( pTempDb, list, insPoint))
> {
> acedAlert("wblock failed!");
> return;
> }
> if (Acad::eOk != acdbHostApplicationServices()->workingDatabase()
> ->insert( AcGeMatrix3d::kIdentity, pTempDb))
> acedAlert("insert failed");
>
> delete pTempDb;
>
> }
> P.S. It doesn't crash. It is simply that no matter what values I put into the insPoint,
> it doesn't change the outcome.
> Mike

--

Check out DWGInfoTip at http://www.caddzone.com/dwginfo.htm

/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.t...@worldnet.att.net */
/* http://www.caddzone.com */
/*********************************************************/

Byron Blattel

unread,
Oct 9, 2000, 3:00:00 AM10/9/00
to
Look at the member functions setToTranslation() or setTranslation(),
setToScaling(), and setToRotation().

I believe you'll need to construct a matrix of the three:

AcGeMatrix3d position, scale, rotation, final;
position.setToTranslation(insert_point);
position.setToScaling(scale);
position.setToRotation(angle, AcGeVector3d::kZAxis);
final = position * scale * rotation;

then pass final to insert...

PSI_Mike wrote:
>
> Tony, It is the latter part. I want to copy the entities
> from one drawing and insert them into the current. If I
> could ask you to finish your thought? The only part
> I got was "use the Tra". hehe, Thank you very much
> for your attention. I really need to know how to position
> these inserted entities. I looked at the AcGeMatrix3d class
> and cannot see anywhere a function for position.
> Mike

--
|
----+----------------------------------------------
| Byron Blattel
| CADwerx---Applications for AutoCAD
|
| by...@cadwerx.net
| http://www.cadwerx.net
|

Byron Blattel

unread,
Oct 9, 2000, 3:00:00 AM10/9/00
to
Let's try that again :)

AcGeMatrix3d position, scale, rotation, final;

position.setToTranslation(some_point);
scale.setToScaling(some_scale);
rotation.setToRotation(some_angle, AcGeVector3d::kZAxis);


final = position * scale * rotation;

--

Tony Tanzillo

unread,
Oct 9, 2000, 3:00:00 AM10/9/00
to
Mike - I believe the setTranslation() member will
accomplish this:

AcGeMatrix3d matrix; // Constructor sets it to kIdentity

matrix.setTranslation(AcGeVector3d(tX, tY, tZ));

PSI_Mike wrote:
>
> Tony, It is the latter part. I want to copy the entities
> from one drawing and insert them into the current. If I
> could ask you to finish your thought? The only part
> I got was "use the Tra". hehe, Thank you very much
> for your attention. I really need to know how to position
> these inserted entities. I looked at the AcGeMatrix3d class
> and cannot see anywhere a function for position.
> Mike

--

Check out DWGInfoTip at http://www.caddzone.com/dwginfo.htm

Tony Tanzillo

unread,
Oct 9, 2000, 3:00:00 AM10/9/00
to
Oops.

This might be more effecient, if you only need
to use the matrix once:

AcGeMatrix3d::translation(AcGeVector(X, Y, Z));

0 new messages