Author Topic: AutoCAD / Rhino coordination  (Read 3610 times)

0 Members and 1 Guest are viewing this topic.

b-rye guy

  • Guest
AutoCAD / Rhino coordination
« on: February 04, 2016, 05:55:07 PM »
Can someone please point me in the direction of creating a program that would allow for cross pollination between AutoCAD and Rhino/Sketchup? i explain below.

I have an idea to host information about a block, such as a manhole, in AutoCAD (i.e., sizes, finish, embossing, etc.). Then, somehow I need Rhino and/or sketchup to communicate with AutoCAD regarding the location of that block and place a matching 3d model in it's place. If the user moves the 3d model in rhino or sketchup, the change is reflected in AutoCAD and vice versa. This would obviously be used for a company like mine which has a preferred workflow of 2D autocad and other programs such as rhino/sketchup for 3D modelling.

I want to spend some time developing this and refining the idea, but have no idea where to start.

Thanks in advance!

b-rye guy

  • Guest
Re: AutoCAD / Rhino coordination
« Reply #1 on: February 04, 2016, 05:56:04 PM »
Can someone please point me in the direction of creating a program that would allow for cross pollination between AutoCAD and Rhino/Sketchup? i explain below.

I have an idea to host information about a block, such as a manhole, in AutoCAD (i.e., sizes, finish, embossing, etc.). Then, somehow I need Rhino and/or sketchup to communicate with AutoCAD regarding the location of that block and place a matching 3d model in it's place. If the user moves the 3d model in rhino or sketchup, the change is reflected in AutoCAD and vice versa. This would obviously be used for a company like mine which has a preferred workflow of 2D autocad and other programs such as rhino/sketchup for 3D modelling.

I want to spend some time developing this and refining the idea, but have no idea where to start.

Thanks in advance!

I should clarify that I have an AutoCAD block already made, and I have a corresponding manhole component already made.

MickD

  • King Gator
  • Posts: 3619
  • (x-in)->[process]->(y-out) ... simples!
Re: AutoCAD / Rhino coordination
« Reply #2 on: February 04, 2016, 11:02:20 PM »
I'm not that familiar with the Rhino/SketchUp api's but I don't think there is any 'automatic' way to keep both app's synced together.

As far as sharing data, that is indeed do-able. I would suggest export/import of a textual format such as JSON, XML or your own. Text is easy to read and parse and there are already libraries for JSON and XML that are more than good enough. DXF is an option as well as most CAD packages can deal with that but it won't give you the smarts to create a 3D object from a 2d block, you will need to interpret the block data and construct your 3d object from that.
Once you decide on your data format for collaboration you will then need to create an interface for both applications to read and write the data into/from each other (or just from 2d to 3d if that's all you need).

Another question begs though, why not just create the 3d model in AutoCAD? This way you could have an auto update feature.
« Last Edit: February 05, 2016, 05:17:49 AM by MickD »
"Short cuts make long delays,' argued Pippin.”
J.R.R. Tolkien

lamarn

  • Swamp Rat
  • Posts: 636
Re: AutoCAD / Rhino coordination
« Reply #3 on: February 05, 2016, 02:58:51 AM »
The only point not Using AutoCAD for the 3D part i can see would be the ability to use some tool like Grasshopper. For a strongly parametric driven model? But to use it some different kinds of manholes I cannot see the effort in using multiple platforms.. Civil3D would be most suitable.. AutoDesk speaking..
Design is something you should do with both hands. My 2d hand , my 3d hand ..

b-rye guy

  • Guest
Re: AutoCAD / Rhino coordination
« Reply #4 on: February 05, 2016, 11:44:44 AM »
The only point not Using AutoCAD for the 3D part i can see would be the ability to use some tool like Grasshopper. For a strongly parametric driven model? But to use it some different kinds of manholes I cannot see the effort in using multiple platforms.. Civil3D would be most suitable.. AutoDesk speaking..

You are exactly correct in that we are using 3rd part software to render out our designs. Manholes, furniture, trees, etc.

b-rye guy

  • Guest
Re: AutoCAD / Rhino coordination
« Reply #5 on: February 05, 2016, 11:46:32 AM »
I'm not that familiar with the Rhino/SketchUp api's but I don't think there is any 'automatic' way to keep both app's synced together.

As far as sharing data, that is indeed do-able. I would suggest export/import of a textual format such as JSON, XML or your own. Text is easy to read and parse and there are already libraries for JSON and XML that are more than good enough. DXF is an option as well as most CAD packages can deal with that but it won't give you the smarts to create a 3D object from a 2d block, you will need to interpret the block data and construct your 3d object from that.
Once you decide on your data format for collaboration you will then need to create an interface for both applications to read and write the data into/from each other (or just from 2d to 3d if that's all you need).

Another question begs though, why not just create the 3d model in AutoCAD? This way you could have an auto update feature.

So this sounds like if I can write the coordinates of a bock in AutoCAD to a XML file, I can use an interface in SketchUp or Rhino to import those coordinates and swap out that AutoCAD block for a SketchUp component?

Sounds simple in theory, I need to figure out where I can learn how to write XML files.

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: AutoCAD / Rhino coordination
« Reply #6 on: February 05, 2016, 01:28:22 PM »
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

MickD

  • King Gator
  • Posts: 3619
  • (x-in)->[process]->(y-out) ... simples!
Re: AutoCAD / Rhino coordination
« Reply #7 on: February 05, 2016, 05:20:15 PM »
So this sounds like if I can write the coordinates of a bock in AutoCAD to an XML file, I can use an interface in SketchUp or Rhino to import those coordinates and swap out that AutoCAD block for a SketchUp component?

Sounds simple in theory, I need to figure out where I can learn how to write XML files.

Yes, you can even hold the modelling data of the 3d object in XML as points, edges, faces and manifolds along with other no graphical attributes.

There are 2 ways to approach this, one would be to create your own XML schema for your files or use a well-known schema such as IFC or LandXML. If you need to store graphical data I'd lean towards the latter and you may be able to find tools to use at both ends of the CAD systems already available (i.e. that can read/write IFC in AutoCAD or Rhino say).
If you are only using placement and non-graphical data from AutoCAD and you have 'blocks' in the other CAD system then a simple XML schema of your own would suffice.
"Short cuts make long delays,' argued Pippin.”
J.R.R. Tolkien

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: AutoCAD / Rhino coordination
« Reply #8 on: February 08, 2016, 01:46:24 AM »
Sounds simple in theory, I need to figure out where I can learn how to write XML files.
Don't worry too much about 'XML'. It's just a file format for saving data, there are many and they're mostly interchangeable. E.g. these days JSON tends to be preferred due to it wasting a lot less space, or in network communications binary JSON is even used to reduce transmittal bandwidth even more.


I would suggest you look towards making your data into serializable objects instead. In nearly all systems there are libraries available to save these serializables into whatever format you wanted (be that XML/JSON/Binary/Database/etc.). Which in turn means you also don't tie yourself into one specific format and can much more easily change later if you run into a need for such. But most importantly, you'd not need to re-create your own format parser - which is a very complex task and is very prone to errors (much better to use a tried and tested library for such).


To get to this system, your first decision should be how you're going to record that any particular object should be "linked" between these drawings. Is it going to be in some extra file, how is that going to imply such links? E.g. is there some identifier in all programs which allow a way to uniquely map a specific object to another in the other program? Do you want these updates to only happen on a specific event - e.g. when opening the file, or when you click a button, or should they happen immediately? Or would you just re-create the objects every time? These things my be affected by specifics regarding the various programs APIs and what capabilities you get from them.


Next, you'd most likely want to create your custom programs in some similar environment. Just so you don't need to learn 3 different languages and environments. E.g. in ACad you've got 4 choices: C++ with ARX, DotNet, AutoLisp and VBA. In Rhino you can do such using Grasshopper, Python, RhinoScript, RhinoCommon (DotNet), C/C++, etc. So it seems DotNet / C++ is probably a good choice. You may find that Sku is where you're gong to find it difficult, you basically have C or Ruby as standard. This may be especially important if you wish to have a live link between running processes - e.g. as you change the object in ACad it immediately updates in Rhino. If you use some form of polling process (e.g. saving to external file and then reading from it later) it would just mean you need to write two (or three) different programs in different environments.


Personally, I'd rather attempt to do as much as possible inside one single program. E.g. use C3D for all of it, perhaps using 3ds to render if needing more than ACad's own renderer. However, I'm not extremely versed on civil stuff, very long since I did any civil drawings. These days it's much more abut architecture and Revit being the major player in that game - so I don't need Sku/Rhino at all. Though I would definitely not recommend Revit for anything even touching any civil project, it's simply not designed for that (just a personal gripe since Revit and any site related stuff is just irritating to say the least).
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

b-rye guy

  • Guest
Re: AutoCAD / Rhino coordination
« Reply #9 on: February 09, 2016, 06:42:25 PM »
Sounds simple in theory, I need to figure out where I can learn how to write XML files.
I would suggest you look towards making your data into serializable objects instead. In nearly all systems there are libraries available to save these serializables into whatever format you wanted (be that XML/JSON/Binary/Database/etc.). Which in turn means you also don't tie yourself into one specific format and can much more easily change later if you run into a need for such. But most importantly, you'd not need to re-create your own format parser - which is a very complex task and is very prone to errors (much better to use a tried and tested library for such).

This makes me wonder if it could be web based using MySQL as my database and PHP code, both of which I know a little bit about. But you do not list PHP as a recognized language by Rhino or ACAD. Certainly there is a way to incorporate MySQL into ACAD, but is it possible to incorporate PHP as well?

Thanks for the very organized and detailed responses!

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: AutoCAD / Rhino coordination
« Reply #10 on: February 10, 2016, 12:59:14 AM »
Certainly there is a way to incorporate MySQL into ACAD, but is it possible to incorporate PHP as well?
MySQL is just a database, you'd be linking to it. And yet another reason to go with Serialized objects instead of parsing your own XML (or whatever) reader/writer. Many a sample of using serialization to store data into databases, or even mapping objects directly into SQL (search for ORM - Object Relational Mapping).


PHP would most likely not be available. It's a special purpose language intended solely for web server end programming.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

b-rye guy

  • Guest
Re: AutoCAD / Rhino coordination
« Reply #11 on: February 11, 2016, 04:25:12 PM »

I would suggest you look towards making your data into serializable objects instead. In nearly all systems there are libraries available to save these serializables into whatever format you wanted (be that XML/JSON/Binary/Database/etc.). Which in turn means you also don't tie yourself into one specific format and can much more easily change later if you run into a need for such. But most importantly, you'd not need to re-create your own format parser - which is a very complex task and is very prone to errors (much better to use a tried and tested library for such).

Just to clarify - "To serialize an object means to convert its state to a byte stream so that the byte stream can be reverted back into a copy of the object. A Java object is serializable if its class or any of its superclasses implements either the java.io.Serializable interface or its subinterface, java.io.Externalizable."

MickD

  • King Gator
  • Posts: 3619
  • (x-in)->[process]->(y-out) ... simples!
Re: AutoCAD / Rhino coordination
« Reply #12 on: February 11, 2016, 04:27:32 PM »
Just to clarify the process a bit I've created a couple of images to review.

One for a simple file transfer scenario and the other using a MySQL database.

A database may be of benefit if you have many users and a lot of standard data that everyone would use. If you are just inserting pre-made 3d models of objects then there's no need for a database, just a folder on your network with all the models.
"Short cuts make long delays,' argued Pippin.”
J.R.R. Tolkien

MickD

  • King Gator
  • Posts: 3619
  • (x-in)->[process]->(y-out) ... simples!
Re: AutoCAD / Rhino coordination
« Reply #13 on: February 11, 2016, 04:35:12 PM »
Just to clarify - "To serialize an object means to convert its state to a byte stream so that the byte stream can be reverted back into a copy of the object. A Java object is serializable if its class or any of its superclasses implements either the java.io.Serializable interface or its subinterface, java.io.Externalizable."

You also can serialise to text which I highly recommend, especially in the early stages so you can actually read and examine the output. This also allows other existing tools that work on text to be used for editing or filtering for data etc. Very handy!

There is no real advantage of binary serialisation other than for a proprietary format (privacy or intellectual property reasons). The difference in file size is negligible if you use the right format (eg. JSON is nearly half the size of an XML when minified).
"Short cuts make long delays,' argued Pippin.”
J.R.R. Tolkien

b-rye guy

  • Guest
Re: AutoCAD / Rhino coordination
« Reply #14 on: February 11, 2016, 04:44:25 PM »
Just to clarify the process a bit I've created a couple of images to review.

One for a simple file transfer scenario and the other using a MySQL database.

Very clear. Thank you very much! I shall get started!