.NET

Reply
Active Contributor
28 Posts
0 Kudos
Registered: ‎03-21-2013
Post 1 of 7

eNoInputFiler Error

373 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*
2,141 Posts
254 Kudos
Registered: ‎04-29-2006
Post 2 of 7

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
28 Posts
0 Kudos
Registered: ‎03-21-2013
Post 3 of 7

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
352 Posts
27 Kudos
Registered: ‎07-24-2007
Post 4 of 7

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
28 Posts
0 Kudos
Registered: ‎03-21-2013
Post 5 of 7

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
762 Posts
100 Kudos
Registered: ‎03-21-2011
Post 6 of 7

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
762 Posts
100 Kudos
Registered: ‎03-21-2011
Post 7 of 7

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 interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!