.NET

Reply
Active Contributor
NLeininger
Posts: 27
Registered: ‎03-21-2013
Message 1 of 7 (344 Views)

eNoInputFiler Error

344 Views, 6 Replies
06-17-2013 02:18 PM

After running the following code block, the drawing becomes unusable, as every time I run ReadDwgFile after a successful run I get "ENoInputFiler."

 

 

foreach (ObjectId attributeObjId in anotherBlkTableRecord)
                                        {
                                            AttributeDefinition attributeDefinition = (trans.GetObject(attributeObjId, OpenMode.ForRead).GetType() == typeof(AttributeDefinition) ?
                                                (AttributeDefinition)trans.GetObject(attributeObjId, OpenMode.ForRead) : null);
                                            if (attributeDefinition != null)
                                            {
                                                if (string.Compare(attributeDefinition.Prompt, attributePrompt, true) == 0)
                                                {
                                                    return GetAttributeValueStep2(activeDb, workingBlock, attributeDefinition.Tag);
                                                }
                                            }
                                        }

 

Am I doing something wrong?

*Expert Elite*
_gile
Posts: 2,114
Registered: ‎04-29-2006
Message 2 of 7 (326 Views)

Re : eNoInputFiler Error

06-18-2013 12:42 AM in reply to: NLeininger

Hi,

 

Look at the 'as' operator.

foreach (ObjectId attributeObjId in anotherBlkTableRecord)
{
    AttributeDefinition attributeDefinition = 
	    trans.GetObject(attributeObjId, OpenMode.ForRead) as AttributeDefinition;
    if (attributeDefinition != null)
    {
        if (attributeDefinition.Prompt == attributePrompt)
        {
            return GetAttributeValueStep2(activeDb, workingBlock, attributeDefinition.Tag);
        }
    }
}

 Or, more efficient, check the underlying type of the ObjectId

RXClass attDefClass = RXClass.GetClass(typeof(AttributeDefinition));
foreach (ObjectId attributeObjId in anotherBlkTableRecord)
{
	if (attributeObjId.ObjectClass == attDefClass)
	{
        AttributeDefinition attributeDefinition = 
	        (AttributeDefinition)trans.GetObject(attributeObjId, OpenMode.ForRead);
        if (attributeDefinition.Prompt == attributePrompt)
        {
            return GetAttributeValueStep2(activeDb, workingBlock, attributeDefinition.Tag);
        }
    }
}

 

Gilles Chanteau
Active Contributor
NLeininger
Posts: 27
Registered: ‎03-21-2013
Message 3 of 7 (289 Views)

Re : eNoInputFiler Error

06-20-2013 11:50 AM in reply to: _gile

I've re-written the code as you suggested.  I still get the error when trying to read a drawing, though.

 

using (Autodesk.AutoCAD.DatabaseServices.Database acDb = new Autodesk.AutoCAD.DatabaseServices.Database(false, false))
                    {
                        acDb.ReadDwgFile(fileToProcess, FileShare.ReadWrite, false, string.Empty);


....

}

 

The bolded line is throwing the error.

ADN Support Specialist
fenton.webb
Posts: 352
Registered: ‎07-24-2007
Message 4 of 7 (266 Views)

Re : eNoInputFiler Error

06-24-2013 09:39 AM in reply to: NLeininger

we need a buildable sample to look at with sample dwg - as far as I can tell, your code doesn't show anything wrong





Fenton Webb

Developer Technical Services

Autodesk Developer Network


Active Contributor
NLeininger
Posts: 27
Registered: ‎03-21-2013
Message 5 of 7 (262 Views)

Re : eNoInputFiler Error

06-24-2013 10:30 AM in reply to: fenton.webb

I'm trying to attach a zip file with the program and sample drawing, but it keeps telling the file is corrupted.

ADN Support Specialist
Balaji_Ram
Posts: 733
Registered: ‎03-21-2011
Message 6 of 7 (242 Views)

Re: eNoInputFiler Error

06-24-2013 09:12 PM in reply to: NLeininger

I had a similar problem in attaching files to another post.

Please try again and if does not work, you can share it using dropbox or mail it to me.

 

 

 

 

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

ADN Support Specialist
Balaji_Ram
Posts: 733
Registered: ‎03-21-2011
Message 7 of 7 (206 Views)

Re : eNoInputFiler Error

07-04-2013 06:34 AM in reply to: NLeininger

Hi Neil,

 

Thanks for mailing the sample project to reproduce the behavior.

 

Iam posting the code snippet that I sent in my reply to you for future reference.

 

To resolve it, you need to lock the document or create the database without associating with the current document.

 

Document doc = Application.DocumentManager.MdiActiveDocument;
using (DocumentLock docLock = doc.LockDocument())
{
using (Autodesk.AutoCAD.DatabaseServices.Database acDb = new Autodesk.AutoCAD.DatabaseServices.Database(false, false))
{
acDb.ReadDwgFile(fileToProcess, FileShare.ReadWrite, false, string.Empty);
//...
}
}

Or create the database without associating it with the active document as :

using (Autodesk.AutoCAD.DatabaseServices.Database acDb = new Autodesk.AutoCAD.DatabaseServices.Database(false, true))
{
acDb.ReadDwgFile(fileToProcess, FileShare.ReadWrite, false, string.Empty);
//...
}

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!