Author Topic: Exploding Mleaders  (Read 2626 times)

0 Members and 1 Guest are viewing this topic.

cmwade77

  • Swamp Rat
  • Posts: 1443
Exploding Mleaders
« on: January 06, 2011, 02:42:44 PM »
Ok, I need to find a way to explode an mleader, then manipulate it's parts afterwards. I have tried both of the following:
(setq items (vlax-invoke-method Obj 'Explode))
(setq items (vlax-invoke Obj 'Explode))

Both return the error message:
; error: ActiveX Server returned the error:
unknown name: EXPLODE

Any ideas?

The other way that I can go about this is I need to find a way to get the coordinates of an attribute that is within a block that is attached to the mleader. Everything that I have tried so far gives me the coordinates of the attribute within the block definition, not as inserted in the drawing.
« Last Edit: January 06, 2011, 02:49:49 PM by cmwade77 »

Lee Mac

  • Seagull
  • Posts: 12922
  • London, England
Re: Exploding Mleaders
« Reply #1 on: January 06, 2011, 02:53:46 PM »
Your problem with Explode occurs because an MLeader doesn't have an Explode Method - as you might have guessed.

vla-Explode only applies to: 3DPolyline , BlockRef, ExternalReference, LightweightPolyline, MInsertBlock, Polygonmesh, Polyline, Region.

You could transform the attribute positions using a transformation matrix based on the insertion/scale & rotation of the block within the MLeader compared to that within the definition.

Lee

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Exploding Mleaders
« Reply #2 on: January 06, 2011, 02:56:16 PM »
Ok, Lee, you lost me at transformation matrix.....huh? I also have not found a way to get the insertion point of the block within the mleader.....unless I am missing something obvious (distinct possibility).

Lee Mac

  • Seagull
  • Posts: 12922
  • London, England
Re: Exploding Mleaders
« Reply #3 on: January 06, 2011, 02:59:12 PM »
Ok, Lee, you lost me at transformation matrix.....huh? I also have not found a way to get the insertion point of the block within the mleader.....unless I am missing something obvious (distinct possibility).

I believe the insertion point of the block is DXF 15 of the MLeader, but I could be wrong. As for the transformation matrix - it would involve a method almost identical to that which I use in this routine.


cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Exploding Mleaders
« Reply #4 on: January 06, 2011, 06:13:49 PM »
Lee, thank you for your help, that got me going in the right direction at least. I think I need to study up more on DXF codes.

Lee Mac

  • Seagull
  • Posts: 12922
  • London, England
Re: Exploding Mleaders
« Reply #5 on: January 06, 2011, 06:59:25 PM »
Lee, thank you for your help, that got me going in the right direction at least. I think I need to study up more on DXF codes.

I don't envy you if you are following the method I proposed in my other thread - its a difficult one indeed.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Exploding Mleaders
« Reply #6 on: January 06, 2011, 07:11:02 PM »
Actually, it didn't take much to adapt work that you had done previously in some other threads, along with some of my code that I had done previously to try to get it to work...really I had it, except for getting the insertion point of the attributes, I am sure that there are more efficient ways of accomplishing this, but this is pretty snappy and works well. It's amazing once I was able to find where the insertion point of the block was just how easy it was.

Lee Mac

  • Seagull
  • Posts: 12922
  • London, England
Re: Exploding Mleaders
« Reply #7 on: January 06, 2011, 07:34:22 PM »
But did you account for varying Block Scale, Rotation & Normal?

Also what about the varying size of the BoundingBox of each attribute - dependent on what text it contains?

And if you were able to obtain the object-oriented BoundingBoxes of the attributes, you then have the task of determining whether the user-picked point lies inside any of the rotated boundingboxes within a tolerance equal to the size of the user's pickbox multiplied by the current screensize/viewsize ratio...


cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Exploding Mleaders
« Reply #8 on: January 06, 2011, 07:38:05 PM »
To be completely honest, I was simply trying to get it working for our purposes and figured I will look at those things later on.

Our blocks are always the same scale and have no rotation when attached to mleaders (per our company standards).

Lee Mac

  • Seagull
  • Posts: 12922
  • London, England
Re: Exploding Mleaders
« Reply #9 on: January 06, 2011, 07:51:20 PM »
To be completely honest, I was simply trying to get it working for our purposes and figured I will look at those things later on.

I was just shocked at your statement that it was "easy"   :-o

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Exploding Mleaders
« Reply #10 on: January 06, 2011, 07:53:59 PM »
I should have clarified, it was easy for our needs...not to take care of all of the other details, although thinking about it, that may not be as hard as I think either, I just need to get the scale and rotation of the block, then I can adjust the code, I will look at it next week.

Lee Mac

  • Seagull
  • Posts: 12922
  • London, England
Re: Exploding Mleaders
« Reply #11 on: January 06, 2011, 08:00:38 PM »
I believe the scale is DXF 16 and rotation DXF 46  :-)

How are you getting the BoundingBox coords though? Or are you approaching it a different way?

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Exploding Mleaders
« Reply #12 on: January 10, 2011, 06:16:40 PM »
I took a mathematical approach, you do need to click near the insertion point of the attribute (0.13 drawing units at a scale of 1) in order for this to work, it may not be the most elegant solution, but at least it works. I have updated my code in the other thread to v1.3 if you want to take a look at my approach.