Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Document.Editor.SelectCrossingWindow crashes with eNotApplicable exception

Anonymous

Document.Editor.SelectCrossingWindow crashes with eNotApplicable exception

Anonymous
Not applicable

Hi,

the attached code is a batch process for all drawing files in a folder. The process consists of opening a file, finding the drawing size and then looking for a spot on that folder where a sticker of a certain size can be placed without overlapping any drawing objects. To check if a spot is empty, I am using Document.Editor.SelectCrossingWindow. Unfortunately my script crashes at that line with an eNotApplicable exceprtion. What am I doing wrong? Thank you!

0 Likes
Reply
488 Views
2 Replies
Replies (2)

jorge_lopez_adsk
Autodesk
Autodesk

Hi Christopher,

 

The code you posted has dependencies so I was not able to debug it. With that said, I think what is happening is that this multi document operation is running inside the context of a single document.

 

There are a few things you can try:

1. Set AutoCAD into SDI mode via the SDI sysvar

 

If that works and is acceptable, then done. Otherwise, you can try:

 

2. Break up MoveStickerCommand() into two functions:

a. MoveSticker uses CommandFlags.Session only to run in the Application Context. This function only goes as far to include:

Document acDrwDoc = Application.DocumentManager.Open(f.FullName, false);

Then add a SendStringToExecute() to acDrwDoc with the string "MoveStickerWorker"

b. New command MoveStickerWorker that uses CommandFlags.Modal only and does the rest of the processing using acDoc.Editor instead of acDrwDoc.Editor

 

Hope this helps.

 

Cheers,

Jorge

 

 


Jorge Lopez
Distinguished Engineer
0 Likes

Anonymous
Not applicable

@jorge_lopez_adsk  THANK YOU! I will try your suggestions and post here what happened.

0 Likes