Autocad macro to fill an area with as many of an object as possible - autocad

Is there a macro function in Autocad that fills an area with as many blocks/objects as possible given a constraint spacing between the objects? For example: a macro to fill a room with as many chairs as possible but leaving a 30cm gap between chairs

Such functionality does not exist as an out-of-the-box command in AutoCAD - you would need to develop a program using one of the available APIs in AutoCAD (LISP/.NET/ObjectARX).

Related

DXF file - how can "AcDbText" entity with a label text be linked to a geometry entity (AcDbPolyline)?

I suppose there may not be a precise answer to this question, but perhaps I can at least understand working with DXF files better...
I need to process DXF files (floor plans) and link the label, which is usually a room name, to the entity representing the specific room.
I have checked the DXF file and there seems to be no link between the two entities. The TEXT entity has a unique handle (code 5) and it has a soft pointer to another object (I think to the general block definition - code 330) but that is not it. So my questions would be:
do I assume correctly that the only way in this case is to compare the coordinates of the label to coordinates of the "nearest" geometry object? This is doable but what if there are a few overlapping objects - I could see some potential risks there.
Is there a way to include a "precise" link from a text entity to a geometry entity in AutoCAD or similar tools? Perhaps with the use of some attributes? My knowledge of DXF is minimal at this point so if anyone could point me to some documentation or example .dxf files where such "precise link" thing is included, it would be great.
Many thanks!
Is there a way to include a "precise" link from a text entity to a geometry entity in AutoCAD or similar tools? Perhaps with the use of some attributes? My knowledge of DXF is minimal at this point so if anyone could point me to some documentation or example .dxf files where such "precise link" thing is included, it would be great.
There may well be other ways to do what you want. Eg:
Grouping Objects
Attributed Blocks
Also, AutoCAD has a mechanism called Extended Entity Data which is included in any DXF data file (see the link provided).
AutoCAD provides some tools for working with XDATA and you can also use third-party extensions like CADPower and GeoTools that have an arsenal of XDATA tools. And ofcourse, you can write you own plugins to do what you what.
In summary, you could attach the handle of the TEXT as XDATA to the POLYLINE representing the room. Once you have attached the TEXT as XDATA it will be available in the DXF file and you will be able to parse it and locate the handle of the TEXT element.
It isn't too hard to write a VBA macro to run in AutoCAD that asks you to select the two elements and it then add the text entity handle as the XDATA. Then you are good to go.

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

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

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.

Drop-shadow with rounded corners in vb6

Various code is available online which make it possible to have drop-shadow in vb6.
Some of the use a separate form which has a darkened framework picture of your main form.
Some others make use of things in-built in windows.
I am planning to make use of the second type since there a numerous forms in my application.
But the 2nd type doesn't allow rounded corners.
Is there anyway I can do this?

Windows 8 Metro Style Horizontal design

I would like to ask which controls can be used to create a design similar to the built-in Weather app - that means different sets of data (tables, lists, etc.) that stretch horizontally and can be scrolled and can use the semantic zoom (which just shows the names of individual sections). I was trying to find some ways, but I have always found only examples using a list of same-type items, that are grouped somehow and shown in a GridView, but nothing similar to those built-in apps.
Thank you very, very much
You can achieve your goal using ItemTemplateSelector.
See here for more information: http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.itemtemplateselector.aspx

Resources