Author Topic: Nested Copy for Bricscad V10  (Read 4190 times)

0 Members and 1 Guest are viewing this topic.

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6940
  • AKA Daniel
Nested Copy for Bricscad V10
« on: January 29, 2010, 05:26:59 AM »
Anyone want to test it for me  ^-^

command = extncopy

« Last Edit: January 31, 2010, 09:00:21 AM by Daniel »

gskelly

  • Newt
  • Posts: 185
Re: Nested Copy for Bricscad V10
« Reply #1 on: January 29, 2010, 07:51:43 AM »
Anyone want to test it for me  ^-^

command = extncopy



Not really sure what it _should_ do but here's what I saw:

- will copy text from an insert as a new text entity
- will copy an attribute from an insert as a new text entity
- will copy text from an XREF as a new text entity
- will not copy line, arc, polyline from insert or XREF
- will copy attribute from insert of nested block (block in block)
- will not copy text from insert of nested block

Bricscad 10.2.10, WinXP Pro SP3

[update]:

- will copy text entity in current dwg to new text entity
- will copy line entity from current dwg to new line entity
Bricscad v12

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6940
  • AKA Daniel
Re: Nested Copy for Bricscad V10
« Reply #2 on: January 29, 2010, 08:49:18 PM »
Great Thank you!!
 It seems this routine will be bound to the limitations of acedNEntSelP. 
The good news is that copying lines, arcs. etc from intesrts, seem to work fine in the latest beta.
« Last Edit: January 29, 2010, 09:03:55 PM by Daniel »

frtfff

  • Bull Frog
  • Posts: 215
Re: Nested Copy for Bricscad V10
« Reply #3 on: January 29, 2010, 09:28:55 PM »
I am trying to test your program in AutoCAD2008,but failed.Do you change your system?
Or others?
And,What's the main function?

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6940
  • AKA Daniel
Re: Nested Copy for Bricscad V10
« Reply #4 on: January 29, 2010, 10:21:28 PM »
I am trying to test your program in AutoCAD2008,but failed.Do you change your system?
Or others?

This was compiled for Bricscad

And,What's the main function?

Similar to express tools ncopy

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Nested Copy for Bricscad V10
« Reply #5 on: January 30, 2010, 04:45:07 AM »

I'll give it a try tomorrow when I download Dan ... Or are you cool ?
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6940
  • AKA Daniel
Re: Nested Copy for Bricscad V10
« Reply #6 on: January 30, 2010, 04:55:55 AM »
Actually I just updated the attachment  :-)

I needed to apply the transformations from each nested owner... if that makes sense..maybe code will explain it better...

@ Greg, it probably was creating the copies, but just placing them in lala land  :laugh:

No Hurries 


Code: [Select]
void copyNested( void )
{
  Acad::ErrorStatus es;
  ads_name ssname = {0L,0L};
  ads_name adsName = {0L,0L};
  ads_matrix adsMatrix;
  resbuf *pbuf = NULL;
  ident_init(adsMatrix);

  if(HandleRtMsg(
      acedNEntSelP(_T("\nSelect Nested Entity: "),adsName,g_adsPoint,0,adsMatrix,&pbuf)) == RTNORM)
  {
    AcDbObjectId selectedEntId , selectedOwnerId;
    TRYRETVOID(acdbGetObjectId(selectedEntId,adsName));
    AcDbEntityPointer selectedEnt(selectedEntId,AcDb::kForRead);
    AcDbEntity *pNewEnt = static_cast<AcDbEntity*>(selectedEnt->clone());
    if (AcDbAttribute::cast (pNewEnt))
    { // based of Alexander Rivilis's code
      AcDbAttribute *pAtt = AcDbAttribute::cast (pNewEnt);
      AcDbText *pText = new AcDbText();
      pText->setPropertiesFrom(pAtt);
      pText->setHeight(pAtt->height ());
      pText->setWidthFactor(pAtt->widthFactor());
      pText->setHorizontalMode(pAtt->horizontalMode());
      pText->setTextStyle(pAtt->textStyle());
      pText->setVerticalMode(pAtt->verticalMode());
      pText->setTextString(pAtt->textStringConst());
      pText->setRotation(pAtt->rotation());
      pText->setPosition (pAtt->position());
      pText->setNormal(pAtt->normal());
      pText->setOblique(pAtt->oblique());
      pText->setThickness(pAtt->thickness());
      pText->setAlignmentPoint(pAtt->alignmentPoint());
      delete pNewEnt;
      pNewEnt = pText;
    }
    if(pbuf)
    {
      // --------------------- needed this  ----------------------
      for(resbuf *ptmp = pbuf;ptmp!=NULL;ptmp=ptmp->rbnext)
      {
        es = HandleESMsg( acdbGetObjectId(selectedOwnerId,ptmp->resval.rlname) );
        if(es == eOk)
        {     
          AcDbObjectPointer<AcDbBlockReference> selectedOwner(selectedOwnerId,AcDb::kForRead);
          if(HandleESMsg(selectedOwner.openStatus()) == eOk)
          {
            TRYMSG(pNewEnt->transformBy(selectedOwner->blockTransform()));
          }
        }
      }
      acutRelRb(pbuf);
    }
    AcDbObjectId id;
    CTools::AddToCurrentSpace(id,pNewEnt);
    moveEnt(id);
  }
}
« Last Edit: January 30, 2010, 05:22:19 AM by Daniel »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Nested Copy for Bricscad V10
« Reply #7 on: January 30, 2010, 05:04:47 AM »

That's a lot of hoop jumping for attribute Text !!!

I'll get Bricscad loaded about lunchtime, so I'll play then :).
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

gskelly

  • Newt
  • Posts: 185
Re: Nested Copy for Bricscad V10
« Reply #8 on: January 30, 2010, 08:58:24 AM »
@ Greg, it probably was creating the copies, but just placing them in lala land  :laugh:


Ah, yes that did it... I tend to work waaaaay away from the origin  :evil:  (currently at 5570000, 4941000 more or less)

I see if I copy a HATCH from an insert it ends up in the wrong place.  I now see the handicap parking symbol I was test on was scaled in x & y only so once I changed that the hatch copy is created correctly.

Copy of lines, arc, polylines, text, attribute and hatch all seem to work properly from inserts and nested inserts...

Anisotropic scaling:
... never mind ... I see the message telling me it cannon scale non-uniformly  :oops:

Is this something that is limited to single entity selection by the system?

Gotta run, I can look into XREF's later if needed and someone else has not.
« Last Edit: January 30, 2010, 09:35:43 AM by gskelly »
Bricscad v12

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6940
  • AKA Daniel
Re: Nested Copy for Bricscad V10
« Reply #9 on: January 31, 2010, 08:37:40 AM »
Well darn, Well I bet ncopy in Acad is doing some other mojo (maybe  explode). I have no idea how its dealing with blocks that are not scaled uniformly  :mrgreen:

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6940
  • AKA Daniel
Re: Nested Copy for Bricscad V10
« Reply #10 on: January 31, 2010, 09:01:30 AM »
added a hack to force the scale... for now... :oops:

gskelly

  • Newt
  • Posts: 185
Re: Nested Copy for Bricscad V10
« Reply #11 on: February 01, 2010, 11:58:43 AM »
added a hack to force the scale... for now... :oops:

Seems to work, looks like for non-uniform scaling it creates the copy as though the block or xref were uniformly scaled with the x-scale factor.

Tested Line, LwPolyline, Arc, Circle, Hatch, Attribute, Text and MText from an XREF.
Bricscad v12

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6940
  • AKA Daniel
Re: Nested Copy for Bricscad V10
« Reply #12 on: February 01, 2010, 06:06:15 PM »
Hah! You got it! It seems that nothing in ARX can handle non-uniform scaled matrices.
I might change from using X to Z since its least likely to be modified.?.

gskelly

  • Newt
  • Posts: 185
Re: Nested Copy for Bricscad V10
« Reply #13 on: February 01, 2010, 06:55:00 PM »
I might change from using X to Z since its least likely to be modified.?.

Hard to say what is best... if the block is scaled the copy desired would likely be something similar in size to the scaled copy. ??? I did not pay any attention to the Z of anything and did not try any 3D entities.

I have no clue what the ncopy in Autocad does... Does it actually handle blocks with non-uniform scales? Does it create ellipse from circle, etc.?
Bricscad v12

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6940
  • AKA Daniel
Re: Nested Copy for Bricscad V10
« Reply #14 on: February 01, 2010, 07:15:38 PM »
...Does it create ellipse from circle, etc.?

hmm Yes it does, I need to take another approach!