Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to Insert Object...

How to Insert Object...

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
10 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Shah Satish
    wrote on last edited by
    #1

    Hi !!! In my application,I have created one dialog box which showing preview of the symbol.Now i want to insert this symbol in my Application( Autocad).How can i insert this?? Ie if I will click OK button from Dialog box then symbol (preview)should be insert in the Autocad.?? Thanking you Shah

    R 1 Reply Last reply
    0
    • S Shah Satish

      Hi !!! In my application,I have created one dialog box which showing preview of the symbol.Now i want to insert this symbol in my Application( Autocad).How can i insert this?? Ie if I will click OK button from Dialog box then symbol (preview)should be insert in the Autocad.?? Thanking you Shah

      R Offline
      R Offline
      Roger Stoltz
      wrote on last edited by
      #2

      :confused::confused: AutoCad[^]? Your application?

      Shah Satish wrote:

      How can i insert this?

      Really hard to tell. I assume that the preview is not the actual object that is to be inserted, but rather a small bitmap or similar just to show the user how it looks. You have to describe the "symbol". What is it? An OLE object, picture or what? You have to describe the target as well. What kind of application is it? What does it mean to "insert" a "symbol"?


      "It's supposed to be hard, otherwise anybody could do it!" - selfquote

      S 1 Reply Last reply
      0
      • R Roger Stoltz

        :confused::confused: AutoCad[^]? Your application?

        Shah Satish wrote:

        How can i insert this?

        Really hard to tell. I assume that the preview is not the actual object that is to be inserted, but rather a small bitmap or similar just to show the user how it looks. You have to describe the "symbol". What is it? An OLE object, picture or what? You have to describe the target as well. What kind of application is it? What does it mean to "insert" a "symbol"?


        "It's supposed to be hard, otherwise anybody could do it!" - selfquote

        S Offline
        S Offline
        Shah Satish
        wrote on last edited by
        #3

        Symol is from my file..Like C:\\Symbol\\Exchangers\\Exchanger_1_i.dwg (here Exchanger_1_i.dwg is the symbol and its Autocad drawing) This is the preview of the dialog box.

        R 1 Reply Last reply
        0
        • S Shah Satish

          Symol is from my file..Like C:\\Symbol\\Exchangers\\Exchanger_1_i.dwg (here Exchanger_1_i.dwg is the symbol and its Autocad drawing) This is the preview of the dialog box.

          R Offline
          R Offline
          Roger Stoltz
          wrote on last edited by
          #4

          Ok... This is how I understood you so far: It is the actual commercial CAD application AutoCad and the "symbol" you want to insert is an AutoCad drawing. So the question is really about "how do I insert an AutoCad symbol in an AutoCad drawing"? Man, you really picked the wrong forum for this question... Try AutoCad support. ;) Actually I don't think this is the case, but if I only read the things you're writing, that would be the only conclusion. The questions in my previous post was meant to narrow the problem down and trying to understand what you're trying to do and how you're trying to do it. At least try to answer those questions if you still want some help. Perhaps I cannot help you, I don't know that yet since you haven't described your problem in an understandable way, but there might be someone else that can. They would ask you similar questions however.


          "It's supposed to be hard, otherwise anybody could do it!" - selfquote

          S 1 Reply Last reply
          0
          • R Roger Stoltz

            Ok... This is how I understood you so far: It is the actual commercial CAD application AutoCad and the "symbol" you want to insert is an AutoCad drawing. So the question is really about "how do I insert an AutoCad symbol in an AutoCad drawing"? Man, you really picked the wrong forum for this question... Try AutoCad support. ;) Actually I don't think this is the case, but if I only read the things you're writing, that would be the only conclusion. The questions in my previous post was meant to narrow the problem down and trying to understand what you're trying to do and how you're trying to do it. At least try to answer those questions if you still want some help. Perhaps I cannot help you, I don't know that yet since you haven't described your problem in an understandable way, but there might be someone else that can. They would ask you similar questions however.


            "It's supposed to be hard, otherwise anybody could do it!" - selfquote

            S Offline
            S Offline
            Shah Satish
            wrote on last edited by
            #5

            Yeh..You got my question correctly.. See my code..

            BOOL CDwgPvDLG::OnInitDialog()
            {
            CDialog::OnInitDialog();

            //static bool isFirstRun = true;
            
            
            m\_mytext.AddString(\_T("Exchanger-Double end"));
                m\_mytext.AddString(\_T("Exchanger-Single end"));
                m\_mytext.AddString(\_T("Exchanger-Double end kettle"));
            m\_mytext.AddString(\_T("Exchanger-Single end kettle"));
            m\_mytext.AddString(\_T("Exchanger-Super"));
            m\_mytext.AddString(\_T("Exchanger-Process Flow"));
            

            if (str == _T("")) {

            // This is default value.
            
               m\_mytext.SetCurSel(0);
            
               mydwg = \_T("C:\\\\Symbol\\\\Exchangers\\\\Exchanger\_1\_i.dwg");
            

            }

            else{

               m\_mytext.SelectString(-1,str);
            }
            
            this->Invalidate(FALSE);
            
            return TRUE;
            

            }

            void CDwgPvDLG::OnPaint()

            {
            // This is the class for preview of my drawing. CDwgPreview ::ShowInDialog (mydwg,this,IDC_PVTYP);

            CPaintDC dc(this); 
            
            // device context for painting
            // TODO: Add your message handler code here
            // Do not call CDialog::OnPaint() for painting messages
            

            }

            void CDwgPvDLG::OnselectionchangeList()
            {
            // TODO: Add your control notification handler code here

            int nEntry = m_mytext.GetCurSel();

            const IndexEntry *pEntry = m_pPermutedIndex->GetIndexTableEntry(nEntry);

            this->Invalidate(FALSE);

            }

            void CDwgPvDLG ::OnOK()
            {
            CDialog::OnOK();

            m_mytext.GetText(m_mytext.GetCurSel(),str);

            //Here i have to add some code for inserting my symbol (.dwg).

            }

            Shah

            J 1 Reply Last reply
            0
            • S Shah Satish

              Yeh..You got my question correctly.. See my code..

              BOOL CDwgPvDLG::OnInitDialog()
              {
              CDialog::OnInitDialog();

              //static bool isFirstRun = true;
              
              
              m\_mytext.AddString(\_T("Exchanger-Double end"));
                  m\_mytext.AddString(\_T("Exchanger-Single end"));
                  m\_mytext.AddString(\_T("Exchanger-Double end kettle"));
              m\_mytext.AddString(\_T("Exchanger-Single end kettle"));
              m\_mytext.AddString(\_T("Exchanger-Super"));
              m\_mytext.AddString(\_T("Exchanger-Process Flow"));
              

              if (str == _T("")) {

              // This is default value.
              
                 m\_mytext.SetCurSel(0);
              
                 mydwg = \_T("C:\\\\Symbol\\\\Exchangers\\\\Exchanger\_1\_i.dwg");
              

              }

              else{

                 m\_mytext.SelectString(-1,str);
              }
              
              this->Invalidate(FALSE);
              
              return TRUE;
              

              }

              void CDwgPvDLG::OnPaint()

              {
              // This is the class for preview of my drawing. CDwgPreview ::ShowInDialog (mydwg,this,IDC_PVTYP);

              CPaintDC dc(this); 
              
              // device context for painting
              // TODO: Add your message handler code here
              // Do not call CDialog::OnPaint() for painting messages
              

              }

              void CDwgPvDLG::OnselectionchangeList()
              {
              // TODO: Add your control notification handler code here

              int nEntry = m_mytext.GetCurSel();

              const IndexEntry *pEntry = m_pPermutedIndex->GetIndexTableEntry(nEntry);

              this->Invalidate(FALSE);

              }

              void CDwgPvDLG ::OnOK()
              {
              CDialog::OnOK();

              m_mytext.GetText(m_mytext.GetCurSel(),str);

              //Here i have to add some code for inserting my symbol (.dwg).

              }

              Shah

              J Offline
              J Offline
              jhwurmbach
              wrote on last edited by
              #6

              In your code, you can probably call your class roughly like this: CDwgPvDLG m_DwgPv; if( IDOK == m_DwgPv.DoModal()) { CString DWGItem = m_DwgPv.str; //do whatever you want with the string the user did select in the dialog } Hope this helps? Feel free to ask more.


              "We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.

              S 1 Reply Last reply
              0
              • J jhwurmbach

                In your code, you can probably call your class roughly like this: CDwgPvDLG m_DwgPv; if( IDOK == m_DwgPv.DoModal()) { CString DWGItem = m_DwgPv.str; //do whatever you want with the string the user did select in the dialog } Hope this helps? Feel free to ask more.


                "We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.

                S Offline
                S Offline
                Shah Satish
                wrote on last edited by
                #7

                Thanks for reply..But this is code for Calling dialog box..I have alreday call dialog box through command..only step is how to insert file ( for exmple this is my string n now i want to insert ..("C:\\Symbol\\Exchangers\\Exchanger_1_i.dwg") every thing should be in On ok().. like..

                void CDwgPvDLG ::OnOK()
                {
                CDialog::OnOK();

                m_mytext.GetText(m_mytext.GetCurSel(),str);

                ads_point point;

                acedGetPoint(NULL,(_T("\nPick position : ")),point);

                // some code here to insert dwg.

                }

                J 1 Reply Last reply
                0
                • S Shah Satish

                  Thanks for reply..But this is code for Calling dialog box..I have alreday call dialog box through command..only step is how to insert file ( for exmple this is my string n now i want to insert ..("C:\\Symbol\\Exchangers\\Exchanger_1_i.dwg") every thing should be in On ok().. like..

                  void CDwgPvDLG ::OnOK()
                  {
                  CDialog::OnOK();

                  m_mytext.GetText(m_mytext.GetCurSel(),str);

                  ads_point point;

                  acedGetPoint(NULL,(_T("\nPick position : ")),point);

                  // some code here to insert dwg.

                  }

                  J Offline
                  J Offline
                  jhwurmbach
                  wrote on last edited by
                  #8

                  Shah Satish wrote:

                  every thing should be in On ok().. like..

                  That is bad style. Have the Dialog do one thing (i.e. get a selection from the user) and do the work from where the dialg had been called. Possibly by opening other dialogs to get the user to answer more specific questions. Or are you doing a dialog-based application and this is your main dialog?


                  "We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.

                  S 1 Reply Last reply
                  0
                  • J jhwurmbach

                    Shah Satish wrote:

                    every thing should be in On ok().. like..

                    That is bad style. Have the Dialog do one thing (i.e. get a selection from the user) and do the work from where the dialg had been called. Possibly by opening other dialogs to get the user to answer more specific questions. Or are you doing a dialog-based application and this is your main dialog?


                    "We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.

                    S Offline
                    S Offline
                    Shah Satish
                    wrote on last edited by
                    #9

                    Yeh..This is MFC dialog based application and this is only one and main dialog box.. Your method is also good but main thing is How to insert ??

                    J 1 Reply Last reply
                    0
                    • S Shah Satish

                      Yeh..This is MFC dialog based application and this is only one and main dialog box.. Your method is also good but main thing is How to insert ??

                      J Offline
                      J Offline
                      jhwurmbach
                      wrote on last edited by
                      #10

                      Shah Satish wrote:

                      Your method is also good but main thing is How to insert ??

                      I have not the faintest idea of how to handle a dwg-file. You would need to know the format, read it, parse it, build an internal representation of it and draw that. Sorry, but I don't think I can help you with that specific problem.


                      "We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups