How to annotate the area of a polyline in autocad command / macro - autocad

Does anyone know of macro or custom command I can make to quickly annotate the area of a polyline in autocad?
I'm doing a project where I need to measure the lot and house size of several city blocks. I've got a drawing going but I don't want to measure and write out the area of each site, that will take to long. I've seen custom commands in the past that quickly do this kind of thing but I don't know how to make my own.
And I'm desperately avoiding doing it by hand one at a time as most likely I will need to make adjustments to my design later on.

The best method I can think of is to utilize the MTEXT command and use a FIELD to link the Area of the Polyline to the MTEXT box.
Type FIELD at the command line, choose Object, select your Polyline and you will see the Area property.
Here is a link on the CADTutor site that covers it a bit more in depth along with a link to a forum post that has this automated via a Lisp routine.
http://www.cadtutor.net/forum/archive/index.php/t-46628.html

Related

How can I programmatically interact with a video game GUI

Before I get shot down on this one, I realize that the 'how' answer for this question might be slightly debatable, however I'm more interested in the 'what'.
In a nut shell I want to know which methods I can use to interact with a PC video game interface. I want to create a program that can extract data from a video game market interface.
My first initial thought was that I would need to programmatically take screen shots and then use some Optical Character Recognition software to extract the text. Then run whatever operation on the extracted text to derive my incites.
Then I was thinking it might just be easier to have a bunch of mini screen shots that I just use to find matches on certain sections of the screen. When a match is found, I would then know what the text is on the screen, without having to actually 'extract' it.
For those out there whom have done this, can you point me in one direction or the other? Perhaps there is a method that I am completely unaware of.
If its the case that this question is not suitable for this forum. It would be much appreciated if you could direct me elsewhere.
Edit: I should probably add that I'm not looking to spend a fortune on this project... so any free software would be the best. Perhaps that's a tall order.
I'm starting to think Sikuli is the direction I'm going to go. Open Source image recognition software, integrates with Python, Ruby, Java, JDBC, JavaScript and more.
-- Expanding on the question --
There are basically 3 categories of tools:
Recorder while you manually work along your workflow, a recorder tracks your mouse and keyboard actions. After stopping the recording, you might playback (autorun your worflow). The recordings can usually be edited and augmented with additional features.
GUI aware the tool allows to programmatically operate on GUI elements like buttons. This is based on the knowledge of internal structures and names of the GUI elements and their features. Some of these tools also have a recording feature.
Visually the tool “sees” images (usually retangular pixel areas) on the screen and allows to act on these images using mouse and keyboard simulation. There might be some recorder feture as well with such a tool.
SikuliX belongs to the 3rd category and currently does not have a recorder feature.
Answer in progress...
In games with moddable UIs, like many MMOs, you could create a mod that streams data through a series of black and white squares that could be read with optical sensors. From there, a microcontroller could deliver the data back to the PC via USB or wifi.
My approach as a noob. First determine if OCR 100% needed, I think this plays a role in speed.
if possible:
-run game in window (allows for trouble shooting and easy troubleshooting)
-is there a high contrast option for game? Will help Sikuli find things
then you plan out your scenarios:
You have to create different functions for different situations. A lot of gaming is "do you see this?" Then "do this" until that is gone.
Start with small parts you want to automate then build on them. Making sure your parts can scale in case small change need to happen, they will. For instance you want to open the menu if you see an object, lets say a tree.
Assume you have some sort of walking algorithm.
setROI(region1) #focus here for tree
if exists(tRee):
click(loCation) #you could hit the shortcut key to opening the menu
click(iTem) #if the item moves in the menu then you may need to scroll to find it first or you can change the ROI and start seeing if sikuli can differentiate your item from one you dont want to click.
You would get that to loop into other actions and proceed. Goodluck.

What do I need to do this?

I am new to coding and wanted to get some hands on practice with a project I have in mind. Here it is:
Let's say you have blank page and on the side of a screen you have several items you can choose to draw on the blank page. For example the background can be mountains, the ocean, a forest etc. On top of that you can place a house, a church or another selectable element. Whatever you like.
It is like a picture editor where you can put together a picture with different pre-given elements. Or like in video games where you can create your own character.
What would I need to build a web application for that kind of thing?
This link should get you started but it won't be the complete answer to your question - http://www.webdesignerdepot.com/2013/08/how-to-use-html5s-drag-and-drop/
Essentially, you can achieve your image dragging and dropping using similar techniques. It will require a bit of Spike work from yourself, and looking into how HTML5 can handle drag and drop. I discovered this resource fairly quickly and I think the solution you want isn't as complicated as you may think, it just requires a bit of know-how regarding drag and drop operations within HTML5 :-)
Also, there may already be some JavaScript based API's that do this sort of thing easier but I'm not too aware - I suppose starting this way could be a great introduction for you and you may wish to expand once you've done some work for it :-)
Hope this helps you and your coding journey!

Is it possible to programatically create labels in AutoCad?

Our engineering department wastes a great amount of time reviewing drawings for errors. The majority of these problems involve human errors in labeling (ie. two rooms have the name 01-01-00-RM). Our IT department has come up with a partial solution by automation the room names. However, the engineers still have to type this into AutoCAD.
Is there any way to create labels in AutoCAD based on another file (ie. an Excel/CSV document)? Ideally, one would create a group in a layer and enforce that all elements be unique, then have them retrieve their values from a document.
EDIT
Some screenshots of the labels. Note, for company reasons, I can't put full PDF screenshots up.
First image showing compact label next to a camera. This was on a floor plan overlay.
Second image showing the full lable next to a camera. This was in the block diagram
Yes it's possible, there some different paths:
Lisp: very common on AutoCAD environment and allow some basic (and not so basic) automations.
VBA/COM: can be used from inside AutoCAD or by external process, just need to CreateObject("Application.AutoCAD") and program the steps
.NET or C++: in-process automation that allow powerful customization, up to a major remodeling of AutoCAD.
So, depending on your expertise, you may choose different approaches. It may also combine with batch processing via AutoCAD Console.
Find more at http://www.autodesk.com/developautocad and at the blog http://adndevblog.typepad.com/autocad
If the labels were blocks with attributes then you could use the ATTOUT and ATTIN commands in Express tools to export / import them in to/out of Excel. Watch for cell formatting in Excel - eg. numbers like 1/2 turn into dates if you leave the formatting as "General".
Programmatically this is reasonably trivial if the data is structured. An AutoCAD drawing is actually a hierarchical object database so everything in it is addressable, finding it is often the hardest part. If you have an AutoCAD installation handy, have a look into a drawing with MGDDBG to get an idea of the database structure.

Boxes linked by 'smart lines' - what's this called ? How's it done?

Terminology question !
In many graphics packages the user can draw a line between two objects (two boxes say) and then when the user moves one of the one boxes subseqently the line moves to keep the (visual) connection in place.
I want to learn more about this functionality might be implemented (really good to find some open source code to read).
So I want to find some terminology for what this type of stuff is called. I saw a reference on stackoverflow to 'wire-based drawing' but that seems to have been an invention of the author rather than a generally used term.
Is there a proper term for this area of graphics software technology ? Any open source libraries that implement it ?
thanks
I believe that most common name is "connectors". You can draw them using pathfinding algorithm (depends on how your objects are represented)
Here is an example of designer that implements what you described.
Diagrams - bloc, flowchart and so on. This type of drawings is usually created by software like Visio and Dia.
Btw, Dia is open source, so you can look at it to see how this is implemented.
These are connectors.
OpenOffice.org implements them. The feature is available in the Writer, Draw and Impress components (the Connectors menu on the Drawing toolbar). However, I have no idea how easy it would be to dig that feature out of their source code. Nevertheless, OpenOffice.org is open source.

Visual Metaphor for Inversion

Before you throw me out into the cold with your bold assertions that this is not programming related, please hear me out.
I'm looking for a visual metaphor (Icon) to suggest the idea of inversion of a filter. So if a user has a filter which reduces a list of 10 items to 4, I want a button that will allow the user to invert the filter to display only the other 6.
Another wrinkle is that the UI will also have a button for removing the filter nearby.
While this certainly isn't a nuts-and-bolts programming question, I think it's relevant to the process of software creation. As a developer it's relatively easy to construct the mechanisms to perform complex filters, but it's all for naught if normal users find the presentation confusing.
If an icon doesn't jump to mind for you, then there probably isn't one that will have obvious meaning to your users either. You're better off using a text label for this.
If it must be an icon, then it doesn't matter much what it is, since users won't be able to guess it any way, but at least try to make it visually distinct and memorable if not particularly intuitive. MS Access uses a funnel to represent "filtering." Maybe use an upside-down or white-on-black funnel for inversion? (An X'ed-out funnel means "don't filter").
Whatever. Like I said, it doesn't matter much.
Maybe it's not the most appropriate, but what about the logical inverter icon?
Maybe something like this: Invert Selection?
If you really need an image, I'd suggest looking at image editing programs like GIMP or Photoshop and seeing how their "invert selection" buttons look.
16x16 pixels is enough to draw two small list boxes with an arced arrow going from one to the other where the second has an inverted selection list of the first.
alt text http://img524.imageshack.us/img524/6782/4092009000139am.png
I think the 3 icons above could be used in one spot with each user click causing a rotation through the 3 of them. I think the above icon set offers the following benefits:
F - clearly communicates it is for a filter control.
Red and Green - clearly communicate ON and OFF action.
The line above F means inversion (I think - based on memories of boolean algebra at university - I could be wrong?)
The use of yellow while still maintaining the F, links the new action (filter inverted) to the previous filter actions let still communicates it is different to the filter simply being turned on or off.
On icon click rotation could be, (starting) Red - Green - Yellow - Red. This is a widely understood rotation pattern that the user would quickly pick-up. Therefore no need for additional filter on/off button.
Simpler solution - a user only needs to look at a single icon (even perhaps only with peripheral vision) to deduce the current state of the control.

Resources