Poll

Display center point

Display center point
0 (0%)
Display center point
1 (100%)

Total Members Voted: 1

Author Topic: Display center point  (Read 8710 times)

0 Members and 1 Guest are viewing this topic.

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6929
  • AKA Daniel
Re: Display center point
« Reply #30 on: December 17, 2009, 06:30:09 AM »
I don't see anything wrong with the code, , is this a modal dialog?

remove the ExtTools_test(void) from your .h and .cpp, you don't need it

gnanapaul

  • Guest
Re: Display center point
« Reply #31 on: December 17, 2009, 06:37:29 AM »
I don't see anything wrong with the code, , is this a modal dialog?

remove the ExtTools_test(void) from your .h and .cpp, you don't need it


Ok i had removed. I sent the program to your mail. It is modeless  dialog.

Please check it out...

Thanks...

Regards,

Paul G

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6929
  • AKA Daniel
Re: Display center point
« Reply #32 on: December 17, 2009, 06:52:45 AM »
it seems that the zip was stripped by your email server, you might just attach it to a post here ( you can remove it later) .
FYI, I do not have VC6 nor Acad 2000 installed on my computer

gnanapaul

  • Guest
Re: Display center point
« Reply #33 on: December 17, 2009, 06:59:55 AM »
Hi Daniel,

OK...Thanks a lot...

Attaching my code snipt.

Code: [Select]
void CSampDialog::OnShowPoints()
{
    ads_name ss;
    if( RTNORM != acedSSGet(_T("P"),NULL,NULL,NULL,ss)) 
          AfxMessageBox("Error Here itself");
    return;

    AcDbObjectIdArray ids;
    if(CSampDialog::SelectionSetToObjectIds(ids,ss) != Acad::eOk)
AfxMessageBox("objectId");
    return;

for(size_t i = 0; i < ids.length() ; i++)
    {
AcDbEntity* pObj = NULL;
if(acdbOpenObject(pObj,ids[i],AcDb::kForRead) == Acad::eOk)
{
AcDbCircle* pCirc = AcDbCircle::cast(pObj);
if (pCirc !=NULL)
{
double dRadius = pCirc->radius();
AcGePoint3d ptCenter = pCirc->center();
acutPrintf(_T("\ncenter (%g,%g,%g) radius %g"),
ptCenter.x,ptCenter.y,ptCenter.z, dRadius);
}
pObj->close();
}
else
acutPrintf(_T("\nFailed to open the object."));
    }
acedSSFree(ss);
}

Acad::ErrorStatus CSampDialog::SelectionSetToObjectIds( AcDbObjectIdArray &setIds, ads_name ssname )
{
    long sslength;
    ads_name ent;
    acedSSLength(ssname,&sslength);
    for (long i = 0; i < sslength; i++)
    {
      AcDbObjectId oId;
      acedSSName(ssname, i, ent);
      if(acdbGetObjectId(oId, ent) == Acad::eOk)
        setIds.append(oId);
      else
        return Acad::eNullObjectId;
    }
    return Acad::eOk;
  }
code in CSampDialog.h

Code: [Select]
class CSampDialog : public CDialog
{
public:
CSampDialog( CWnd* pParent = NULL );

void OnCopy2Excell(const char* pWhat, const AcDbObject* pDbObj);
afx_msg void OnShowPoints();
static Acad::ErrorStatus SelectionSetToObjectIds( AcDbObjectIdArray &setIds, ads_name ssname );

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6929
  • AKA Daniel
Re: Display center point
« Reply #34 on: December 17, 2009, 07:04:01 AM »
I meant attach the zip to a post here  :-)

your missing a few braces

Code: [Select]
void CSampDialog::OnShowPoints()
  {
    ads_name ss;
    if( RTNORM != acedSSGet(_T("P"),NULL,NULL,NULL,ss)) 
    {
      AfxMessageBox("Error Here itself");
      return;
    }

    AcDbObjectIdArray ids;
    if(CSampDialog::SelectionSetToObjectIds(ids,ss) != Acad::eOk)
    {
      AfxMessageBox("objectId");
      return;
    }

    for(size_t i = 0; i < ids.length() ; i++)
    {
      AcDbEntity* pObj = NULL;
      if(acdbOpenObject(pObj,ids[i],AcDb::kForRead) == Acad::eOk)
      {
        AcDbCircle* pCirc = AcDbCircle::cast(pObj);
        if (pCirc !=NULL)
        {
          double dRadius = pCirc->radius();
          AcGePoint3d ptCenter = pCirc->center();
          acutPrintf(_T("\ncenter (%g,%g,%g) radius %g"),
            ptCenter.x,ptCenter.y,ptCenter.z, dRadius);
        }
        pObj->close();
      }
      else
        acutPrintf(_T("\nFailed to open the object."));
    }
    acedSSFree(ss);
  }

gnanapaul

  • Guest
Re: Display center point
« Reply #35 on: December 17, 2009, 07:08:13 AM »
Ok...

I have attached here...

gnanapaul

  • Guest
Re: Display center point
« Reply #36 on: December 17, 2009, 07:31:55 AM »
Hi Daniel,

I thing the Error is in

Code: [Select]
void CSampDialog::OnShowPoints()
{
ads_name ss;
if( RTNORM != acedSSGet(_T("P"),NULL,NULL,NULL,ss))


gnanapaul

  • Guest
Re: Display center point
« Reply #37 on: December 17, 2009, 07:47:56 AM »
Hi Daniel,

Please help me...

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6929
  • AKA Daniel
Re: Display center point
« Reply #38 on: December 17, 2009, 07:53:15 AM »
try this

Code: [Select]
void CSampDialog::OnShowPoints()
{
AfxMessageBox("hi");
ads_name ss;
if( RTNORM != acedSSGet(_T("P"),NULL,NULL,NULL,ss))
{
if( RTNORM != acedSSGet(NULL,NULL,NULL,NULL,ss))
{
AfxMessageBox("Erroe Here itself");
return;
}
}

AcDbObjectIdArray ids;
if(CSampDialog::SelectionSetToObjectIds(ids,ss) != Acad::eOk)
{
AfxMessageBox("objectId");
return;
}

for(int i = 0; i < ids.length() ; i++)
{
AcDbEntity* pObj = NULL;
if(acdbOpenObject(pObj,ids[i],AcDb::kForRead) == Acad::eOk)
{
AcDbCircle* pCirc = AcDbCircle::cast(pObj);
if (pCirc !=NULL)
{
double dRadius = pCirc->radius();
AcGePoint3d ptCenter = pCirc->center();
acutPrintf(_T("\ncenter (%g,%g,%g) radius %g"),
ptCenter.x,ptCenter.y,ptCenter.z, dRadius);
}
pObj->close();
}
else
acutPrintf(_T("\nFailed to open the object."));
}
acedSSFree(ss);
}

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6929
  • AKA Daniel
Re: Display center point
« Reply #39 on: December 17, 2009, 07:55:10 AM »
"C:myfile.csv" should be "C:\\myfile.csv",

gnanapaul

  • Guest
Re: Display center point
« Reply #40 on: December 17, 2009, 07:58:25 AM »
yes...

It is working...  Thanks a lot...

But it is showing all circles property.

Not showing selected...

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6929
  • AKA Daniel
Re: Display center point
« Reply #41 on: December 17, 2009, 08:11:58 AM »
not on mine, it's showing the same data twice though

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6929
  • AKA Daniel
Re: Display center point
« Reply #42 on: December 17, 2009, 08:13:43 AM »
and at the command line

center (23.453598,20.164042,0.000000) radius 1.695061
center (14.396755,19.541202,0.000000) radius 2.117912

gnanapaul

  • Guest
Re: Display center point
« Reply #43 on: December 17, 2009, 08:17:51 AM »
yes...

Thanks a lot...

You are genius...

i never forget this help...

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6929
  • AKA Daniel
Re: Display center point
« Reply #44 on: December 17, 2009, 08:21:20 AM »
I would add another button to allow the user to select the circles to export  :-)