Author Topic: Question about Side Database  (Read 1903 times)

0 Members and 1 Guest are viewing this topic.

pBe

  • Bull Frog
  • Posts: 402
Question about Side Database
« on: May 09, 2016, 12:43:29 PM »
I read about "side database" here -> http://adndevblog.typepad.com/autocad/2012/07/using-readdwgfile-with-net-attachxref-or-objectarx-acdbattachxref.html

and a c# code from Jeff H. -> https://www.theswamp.org/index.php?topic=31863.msg411012#msg411012 to which i added a line user prompt....

Code: [Select]
     
      PromptStringOptions Xrefsource = new PromptStringOptions("Enter Source: ");
            Xrefsource.AllowSpaces = true;
            PromptResult xrefRes= acDoc.Editor.GetString(Xrefsource);

            PromptStringOptions XrefTarget = new PromptStringOptions("Enter Target: ");
            XrefTarget.AllowSpaces = true;
            PromptResult hostRes = acDoc.Editor.GetString(XrefTarget);

            string xrefPath = (xrefRes.StringResult);
            string hostPath = (hostRes.StringResult);


in place of the hard coded path and refname.

& Because of my limited knowledge in .NET, i invoke the C# code from a lisp routine

Code: [Select]
(foreach itm '(a list of dotted pair)
  (command "_AttachXref" (car itm) (cadr itm))
)

True enough it works as advertised.

Also found this useful link http://adndevblog.typepad.com/autocad/2012/12/binding-external-references.html

Question: Will they work together? Xref bind and side Database. Just need to know if its doable before i pursue this

On a side note. I keep reading about learning basic .Net programming first before dive into Autocad .NET API. you know what.. You guys are absolutely  right :)
« Last Edit: May 10, 2016, 12:01:20 AM by pBe »

nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
Re: Question about Side Database
« Reply #1 on: May 09, 2016, 04:00:29 PM »
Binding in a side database definitely works.

This might work for what you need though:

https://apps.autodesk.com/ACD/en/Detail/Index?id=1241479836291517004&appLang=en&os=Win32_64

pBe

  • Bull Frog
  • Posts: 402
Re: Question about Side Database
« Reply #2 on: May 12, 2016, 02:24:01 AM »
Binding in a side database definitely works. ...

Thank you for the confirmation.

Code - C#: [Select]
  1. (foreach itm '(a list of dotted pair)
  2.  (command "_AttachXref" (car itm) (cadr itm))

What it does right now is, step in "_AttachXref" , do the thing then step out. multiple call that is
How do you pass a list to a .NET program?  Is there a way to run the list inside "_AttachXref" ?

gile

  • Gator
  • Posts: 2520
  • Marseille, France
Re: Question about Side Database
« Reply #3 on: May 12, 2016, 02:50:17 AM »
Hi,

While using side Database, you cannot access the editor so you cannot invoke commands (the same as using ODBX with LISP).

If you think you're now enough comfortable with the .NET environment to learn the AutoCAD API, you need to forget your LISP knowledge and think "how can I do this with .NET" rather than "how do I did this with LISP".
Speaking English as a French Frog

pBe

  • Bull Frog
  • Posts: 402
Re: Question about Side Database
« Reply #4 on: May 12, 2016, 03:38:40 AM »
..
While using side Database, you cannot access the editor so you cannot invoke commands (the same as using ODBX with LISP)...

Got it.

If you think you're now enough comfortable with the .NET environment to learn the AutoCAD API, you need to forget your LISP knowledge and think "how can I do this with .NET" rather than "how do I did this with LISP".

Might as well :)  Time to hit the books.

Thank you Gile