AutoCAD .NET :: Retrieving Active Layout During Plotting
May 27, 2013
This error happened to us, when we tried to get the active layout from the acad document. We are using AutoCAD 2009 & C#.NET 4.0 Framework.
The error is as below:
Unable to cast COM object of type 'Autodesk.AutoCAD.Interop.Common.AcadLayoutClass' to interface type 'Autodesk.AutoCAD.Interop.Common.IAcadLayout'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{C6F55F5A-33AF-4B5F-9949-86C6AEEF1834}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
The piece of snippet looks like the following
using Autodesk.AutoCAD.Interop.Common;
AcadApplication acadApp = (AcadApplication)Marshal.GetActiveObject("AutoCAD.Application");
AcadDocument acadDoc = acadApp.ActiveDocument;
//The following line throws the error as stated above
But it can be accessed if we change the property " Embed Interop Types " of DLLs (a) Autodesk.AutoCAD.Interop
(b) Stdole
from True to False
But again it throws the same error when we try to retrieve any methods from the retrieved AcadLayout. The whole application works fine with AutoCAD 2012 after re-referencing the DLLs.
I am trying to plot a paper space as JPG, the drawing scale is 1:1 the paper is the size an a4 page, I tried using the publish to web JPG.pc3 but the lines come out as gray and faint, I tried all the different combination of pixels and scale but without success!
I made a 90 meter box in model, created a titleblock and added a viewport in layout. The viewport scale is 1:1. Plotting scale is 1:1. It just dawned on me that because everything is 1:1.... I should have a peice of paper 90 meters long. My thick head has managed to confuse me, Does Cad apply a scale to the viewports even though its set 1:1 and plotted 1:1?
If I used millimeters as my UNITS, how can I scale them when plotting it into A1 or A0? How will I know the scale that I will use in Layout tab so that it will fit on the paper that I will used?
I have floorplans from a building with a total of 80 appartments. Now i want to plot PDFs in A3 format, each page with 1 appartment. That would be 80 pages/PDF-files.
The way i did it up to now was i have put all A3 pages in a single layout and used the Window-function in the Plot dialog to print each page individually, manually numbering the file-names, and combining files in Acrobat as needed.
But doing this for 80 pages is too much - especially because i will likely have to plot it more often in the future. As far as i can see, i could make 80 layouts and use the Publish function, make a sheet-list and plot that way.
I keep wondering - is there not a more efficient solution to this problem than creating 80 layouts? There must be a more intelligent solution to this. Whats the preferred way of doing this?
We have a new printer/plotter in our office and Autocad cannot find the old one and so I have to select the new one. Here's the scoop:
When I am in the layout tab, everything is perfectly aligned in my layout sheet (24 x 36) and so I type plot and before the dialogue screen appears (We just got a new plotter) Autocad says: "such and such printer: This plotter config. cannot be used for blah blah blah.... The None plot device has been substituted." Which makes sense because that such and such printer is non existent. So i click ok. and the usual plot dialogue screen displays.
I select our new plotter and the exact size of my layout sheet (24 x 36) and click apply to layout and then preview it and it shows the layout cutting off my titleblock on the right hand side. So I cancel the plot (having applied the new printer and 24 x 36 config.) and look at my layout and either my layout sheet or my linework has shifted about 3/4" up and 3/4" to the side.
Why did something shift? My layout sheet was already aligned and at 24 x 36. I don't want to have to move it every time especially if I need to print off older drawings which are set up with the non existent printer. Should I or could I make autocad ignore the old printer and tell it to recognize the new one so I wont ask me every time i open an older drawing?
Plotting a drawing from layout produces crowded labels,
This is the second time I’m highlighting this issue. I couldn’t figure out how to print a drawing (attached) from the lay out. What I got is a very crowded drawing as shown in the screenshots below.
I wanted to print my drawings (contour, horizontal alignment, vertical alignment, etc.) in an A4 with a scale of 1/1000 or 1/1300. Then what should be:
The annotation scale? The viewport scale? The plot scale?
What did I get very crowded drawing when I tried to print from the layout?
I guess the title pretty much says it all Dashed lines in my drawing turn solid when i switch to the layout area, and when i try to plot. I've tried fiddling with line type scale, but it hasn't solved the problem. I've attached one of the drawings i'm having trouble with.
I think i might have figured it out, when i set lts to 0.05 the show up fine in the layout area, but in the drawing are it looks like the line type scale is way too low. why the dashed lines don't show up the same in the drawing and layout areas?
Since Edge only has rectangles and ellipses built in as available shapes, how to I/we work with polygon shapes and active mouseover areas INSIDE of these shapes and non-active mouseover areas OUTSIDE of the shapes?
Problem/symptom: when I import a polygon, be it any file format from from Photoshop or SVG from Illustrator, a rectangular border/background (transparent) gets applied, leading to this rectangle defining the mouseover area of the shape - and not the shape itself (be it a star or whatever).
WHAT I WANT: the very shape defines the mouseover area. How do I achieve this?? See examle below:
I was given a C3D file with a road alignment including sections. But the all the road data is a block. Is there a way to retrieve all the data in order for me to do some quanities for my estimates on material volumes. When I go to the prospector tab, there are no points, surfaces, or alignments listed.
I created a sketch then tried to retrieve dimensions in a drawing from the sketch. When I used the retrieve function, no dimensions appeared. I made sure that the box in the Application Options under the Tools tab was checked for retrieving all dimensions upon placement. I have tried numerous ways to retrieve the dimensions, and while I can place them manually, I really need to be able to retrieve all at once as seen on the sketch.
I have been able to use the retrieve function before on files that I downloaded from a website so I know to use the function.
I'm attaching a file which I am having trouble retrieving dimensions. I am using Inventor 2013 educational version.
I am using an AutoCAD 2012, when a revised Xref floor plan was send but on a binded file. How to declare or make an Xref file based on the binded file????
I am working on extracting information from DWG with extended Property Set Definitions. I have added Location Property on my Door objects, and would like to retrieve it in my application.
Definition as shown in AutoCAD > Manage > Style Manager > Property Set Definitions
DoorObjects Property Set Name: AtSpaceID Description: Space - SpaceObjects - SpaceID Type: Location (becomes Automatic inside .NET API code) Source: Space - SpaceObjects - SpaceID Space Objects Property Set Name: SpaceID Description: SpaceID Type: Integer
I have tried the .NET API. see Code below. I am stuck at Property Definition Location. Not too sure where I can retrieve the value for my At Space ID at my Door Objects.
I tried the following code below and it throws error such as eInvalid Input or eNot Applicable.
Part of my code
Door doorEntity = trans.GetObject(doorObjID, OpenMode.ForRead) as Door;ObjectIdCollection idsPropSet = PropertyDataServices.GetPropertySets(doorEntity);foreach (ObjectId idPropSet in idsPropSet){ PropertySet propSet = trans.GetObject(idPropSet, OpenMode.ForRead) as PropertySet; PropertySetDefinition propSetDef = [Code]........
I am opening a drawing file whose units are already set to "Architectural - Inches".When im retrieving the coordinates of lines present in drawing it is returning in some other format.How do i change this.Or how do i know in what unit system the values are being returned.
I need to create and maintain a library of hole features of varying shapes and sizes (there will only be around 10 variations). The goal is to be able to programmatically retrieve a feature and then place it in the current part. Ideally I would like to be able to assign each an ID to each feature that I can use to programmatically retrieve it.
My first thought on how to achieve this is to have one master part file that contains all of the features. When I need one I can open that file and somehow copy the appropriate feature and then place it in the target file.
Or maybe it would be better to save each feature in its own part file? I'm not so much looking for code as much as general guidance on whether either of these approaches sound reasonable. Maybe there is a better way to programmatically store and retrieve features from a library?
I have already developed my VB.NET Windows Form app (.NET 4.0 in VS2012) which does some Windows operation on roughly hundreds of AutoCAD drawing files(e.g. purely copy/move/rename type of actions).
Now I need to tell my app to communicate with AutoCAD 2013 and collect some attributes from a specific existing block in all of these drawings and then replace the collected values with some other values passed to AutoCAD by my Form application (see diagram below)
I had a look to couple of AutoCAD .NET blogs and realized how to make DLL files and leverage NETLOAD tool in AutoCAD afterwards but I am afraid DLL files and NETLOAD are not what I am looking after .
I would like to clearly know what is the best pathway to achieve my goal described above.
What about creating an AutoLisp selection set from .NET - is it possible, if so I would prefer to do that instead?
The goal is to create some objects in .NET (using activeX or managed code) and then have some way to access these objects via the command line I'm assuming they only way is using an AutoLISP selection set.
I'm attempting to plot a drawing with a 3d shape and a title block around it. I would like for the occluded lines to not be drawn therefore I'm using the hidden visual style and set shade plot to hidden as well.
My problem arises from the quality of the plot to PDF versus the quality coming out of a printer. It is just a 8.5x11 page. The pdf comes out with horrible anti-aliasing and jagged lines, whereas the print is entirely smooth. Is there something simple I'm missing? It would be even better to find a way to make the plot to PDF come out in vector format! I know it is possible to show the layers and have them vectorized in a PDF... How is this done?
Having tested it in different ways, it looks like at the end, el1 represents the association list that I want my object to have, but it doesn't want to update.
I am modifying stuff in a dynamic block insert entity. There is no "endblk" entity at the end of these definitions and I need to cycle through every entity within the block definition. When it gets to the last entity, I get an error because you cannot entnext passed the last entity. There are 2 things:
1. How to retrieve the # of entities in a block without cycling through it. Or 2. A quick lesson in the *error* function, I cannot figure out how to implement this. I basically want to to say:
(if (entnext myent)) returns a error, don't abort & continue on.
I have a bit of a problem with Autocad map 3d 2012. When i try to insert a scale bar or a north arrow or any other carthographic element i simply can't find the layout elements that are supposed to be in layout tools tab. I've done a lot of research online and can't come up with anything.
I don't remember if I ever used an Adobe screen name. I'm trying to join the community forum, and the system doesn't accept any screeb name I offer. How can I set or reset or retrieve my screen name?
Where can I find an Old Photoshop catalog on elements 9? Computer crashed, had to reinstall, when that was done, I got errors saying I can't use 2 copies, so I called Adobe. It never dawned on me at that time that my whole entire catalog would be erased.
On completion of an image upload to Flickr using the Lightroom Flickr publish plugin I see in the progress bar at the top left state that "comments are being retrieved from Flickr". I never see any other mention of "comments" in Lightroom so what does this mean? I have many comments on my images on Flickr so are they retrieved and downloaded? I have LR4 and Mac OS.
Recently changed file names and now need to revert back to the original file name created via camera. Can this be done in LR 4 or is this info deleted?