Author Topic: Base Point Location of Block Reference  (Read 6261 times)

0 Members and 1 Guest are viewing this topic.

kwarmington

  • Guest
Base Point Location of Block Reference
« on: April 28, 2009, 07:44:17 PM »
I am having trouble getting the "Base Point" of a Block Reference in autocad. I am not sure if base point is the correct terminology or not.

If I perform a LIST command on a Block Reference in autocad the values for the location are the same as if I use the BlockReference.Position in .NET i.e.

                  External reference
                at point, X=128170.18580000  Y=44629.83387360  Z=26037.43318039
   X scale factor: 1.00000000
   Y scale factor: 1.00000000
   Z scale factor: 1.00000000
Extrusion direction relative to UCS:
                   X=0.00000000  Y=-0.25881731  Z=0.96592629

However if i use a LISP command (entget (car (entsel))) I get different values in the dxf code 10 position. The values that I get here, are the ones that I want to get in .NET.
 
i.e.
Select object: ((-1 . <Entity name: -51963e98>) (0 . "INSERT") (5 . "29F5")
(102 . "{ACAD_XDICTIONARY") (360 . <Entity name: -51963e90>) (102 . "}") (330 .
<Entity name: -4011f2f8>) (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 .
"ADE_TEMP") (100 . "AcDbBlockReference") (2 . "T61-5-2-0103") (10 128170.0
49848.1 13599.3) (41 . 1.0) (42 . 1.0) (43 . 1.0) (50 . 1.5708) (70 . 0) (71 .
0) (44 . 0.0) (45 . 0.0) (210 0.0 -0.258817 0.965926))



Does anyone know the equivalent .NET command to get the Block References original insertion point (base point) which is the same as a the DXF 10 code?

In VBA I have noticed there is a object.BasePoint property however I do not know how to convert this to .NET.

Cheers,

Kate




Bryco

  • Water Moccasin
  • Posts: 1883
Re: Base Point Location of Block Reference
« Reply #1 on: April 28, 2009, 08:36:02 PM »
Position?

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2140
  • class keyThumper<T>:ILazy<T>
Re: Base Point Location of Block Reference
« Reply #2 on: April 28, 2009, 10:10:30 PM »
Position !

Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

kwarmington

  • Guest
Re: Base Point Location of Block Reference
« Reply #3 on: April 29, 2009, 02:21:33 AM »
Thanks for the replies -

I have had a look around today and I think my question is now -

How do I translate the position of the block reference to what it was before the blockRef.Normal was applied.

So I place the block Reference at the correct position
I change the block reference's extrusion using Blockref.Normal which in turn gives it a new position.

I need the original position of the block for my comparision. So i need to somehow "undo" the extrusion I have applied without manipulating the block.

Im nearly certain I am doing all my calcualtion in WCS and position is in WCS, but I also dont really know what I'm doing :)

I can post code if it will help in anyway.

Cheers,

Kate

SEANT

  • Bull Frog
  • Posts: 345
Re: Base Point Location of Block Reference
« Reply #4 on: April 29, 2009, 04:51:11 AM »
If the ultimate goal is to place a BlockRef at a particular point with a particular normal then one method would be to reverse the order of operation.  For instance,

Insert the Reference at 0,0,0

Set Refernce.Normal

Set Reference.Position
Sean Tessier
AutoCAD 2016 Mechanical

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Base Point Location of Block Reference
« Reply #5 on: April 29, 2009, 11:00:55 AM »
Would you have to transform the point by the inverse of the block's matrix ( to get it back to WCS )?

Point3d.TransformBy( BlockRef.BlockTransform.Inverse() );
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

SEANT

  • Bull Frog
  • Posts: 345
Re: Base Point Location of Block Reference
« Reply #6 on: April 30, 2009, 06:22:28 AM »
Ah, yes. . . . the situation does seem more concerned with a post insertion query.   The OP expands further on the request here:

http://discussion.autodesk.com/forums/thread.jspa?threadID=726226&tstart=0
Sean Tessier
AutoCAD 2016 Mechanical

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Base Point Location of Block Reference
« Reply #7 on: April 30, 2009, 06:23:10 AM »
Looks like Tony is helping you additionally elsewhere.
Be sure to post back with the resolution :)



edit: oops simultaneous posting :)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

kwarmington

  • Guest
Re: Base Point Location of Block Reference
« Reply #8 on: April 30, 2009, 07:34:04 PM »
Hi Everyone,

Thanks for all your help. I have just posted again over on the AutoDesk Discussion group. I have posted some sample drawings and some sample code.

Still not entirely sure what is going on. Hopefully I can solve this today - going on holidays for 2 weeks, and work will not be happy if its not fixed!

http://discussion.autodesk.com/forums/thread.jspa?threadID=726226&tstart=0


kwarmington

  • Guest
Re: Base Point Location of Block Reference
« Reply #9 on: May 01, 2009, 12:03:01 AM »
Thanks to SeanT my problem has been solved :)

over on the autocad site he posted -
Code: [Select]
Point3d zero = new Point3d();

Point3d GCTp3d = zero - zero.TransformBy(br.BlockTransform.Inverse()).GetAsVector();//Crux

GCTp3d = GCTp3d.RotateBy(br.Rotation, new Vector3d(0.0,0.0,1.0),zero);

which worked fantastically!

Thank you!

SEANT

  • Bull Frog
  • Posts: 345
Re: Base Point Location of Block Reference
« Reply #10 on: May 04, 2009, 11:10:26 AM »
Quite predictably, Tony did ultimately post the best solution.  I’m happy, however, to have provided an interim solution.  I may even be so bold as to say that my offering helped focus the problem.  :-)
Sean Tessier
AutoCAD 2016 Mechanical