AutoCAD .NET :: Changing Document Focus While Executing A Command
Sep 30, 2012
I am occasionally developing with ObjectARX 2013. The problem: A command being executed from a document needs to focus on another document. I am doing that as:
After this line, the focus is taken by the other document. But the command execution just stops without producing any visible error or catchable exception. Apparently, the document focus cannot be changed during execution of a command.
A solution: What worked in the end was displaying a .NET form inside the command, like:
Then, performing the very same set of actions on a button click works flawlessly.
The question is: can using the form as a mediator be avoided? It is redundant there. I tried hooking to CommandEnded, executing the code as a separate command via Application.DocumentManager.MdiActiveDocument.SendStringToExecute, and also executing the code in a separate delayed thread. So far, only triggering the code via the form worked.
when i work on geometry which is not in orthographic orientation i always prefer to create orthographic view of this, that's what i do :
Command : ucs Command : z Command : (selecting representative angled 2 points) Command : plan Command : c
than the whole zoom is lost , and i need to find again the portion , and save a view. i want to automate this process but before i automate it i want to know if there is a way to avoid zoom lost after executing the (plan) command?
I have a macro that automatically creates a Detailed view on a sheet. It works on 2 input's:
- mouse click 1 (set's the target to be detailed)
- mouse click 2 (set's the location where the balloon should be)
The code works fine. But sometimes the user will start another command, or restart the same command, while it is still running. This off course gives all kinds of problems.
Is there a possibility in VBA to prevent the user to start another command while this command is running?Or is this problem a part of the clicking itself?
Here is my (it uses a Class Module called: clsGetPoint, see code below) Sub AutoDetailedView() On Error GoTo ErrorManagment '(error handling 2013/02/18) 'step 0 Create a transaction. -> for 1 undo command Dim oTransMgr As TransactionManager Set oTransMgr = ThisApplication.TransactionManager Dim oTrans As Transaction Set oTrans = oTransMgr.StartTransaction(ThisApplication.ActiveDocument, "AutoDetailedView") 'step 1 Select a drawingView 'Set a reference to the drawing document. Dim oDrawDoc As DrawingDocument Set oDrawDoc = ThisApplication.ActiveDocument 'Set a reference to the active sheet. [code].....
this gives me the path of the acad.lsp, that is provided it actually exists, however because the acad.lsp is not compulsory it may indeed not exist meaning that the command prompt would return the NIL value instead of the pathname.
based upon that I would like to create a new acad.lsp file if not found by autocad.
How does one programmatically set the command line to have keyboard focus?
I'm programmatically setting an active/focused PaletteSet's visibility to false.
_paletteSet.Visible = false;
I would like to follow this line with code that sets the command line to receive focus.
The PaletteSet for other reasons has KeepFocus = true.
I've tried various Win32 APIs (SwitchToThisWindow, SetForegroundWindow, SetActiveWindow) to no avail. I also tried SendCommand() and SendStringToExecute(activate=true,..) , etc.
I imagine there's a way to do this with the native APIs.
How can I stop changing active document? I was thinking I could use this, but I don't know how to cancel it in the event handler:
AcadApp.DocumentManager.DocumentToBeActivated += new DocumentCollectionEventHandler(DocumentManager_DocumentToBeActivated);static void DocumentManager_DocumentToBeActivated(object sender, DocumentCollectionEventArgs e){ // Messagebox to ask if user are sure bool AreYouSureYouWantToChangeActiveFile = MessageBox.... if(!AreYouSureYouWantToChangeActiveFile) //cancel change active file somehow...???}
I have a county wide aerial image in jp2 format, connected through Data Connect and every time I pan or zoom it says "executing query". It is very slow getting around in the drawing (tracing over tree line, roads, etc.). I have a Windows 7 64-bit machine with 6 GB of RAM. Is there a setting I can turn off to make zooming, panning, changing layouts, etc. faster?
What's the best way to change the primary command on a ribbon panel? I want to set Pline as the primary command on the draw panel as it is currently line. I've managed to get it to work (sort off) but shouldn't it as simple as right click "set as primary command"?
I am producing some floor plans which I am having to split into several sheets. I am reusing the overall plan in small scale as a key/location plan (in a seperate viewport).
As the viewport is at small scale I want to make the pens thinner so walls don't come out too thick so I go into the layer manager and change the viewport pen colours and freeze off unwanted layers. Trouble is although I can copy the viewport between sheets and drawings it won't remember the layer settings is there a way that I can either: Set a variable to remember the layer settings within the viewport when copying Write a script to change the layer colours within the viewport and vp freeze the unwanted layers so all the keyplan match between all of my sheets.
The script wouldn't be too much problem for me as I mostly use key commands but when I tried changing the layer colours using -la -> c -> red all the viewports changed not just the current one. Is there a different command to change the viewport colours or is it just not possible from the command line.
Floating command line width gets shorter and shorter everytime you open up AutoCAD? Civil 3D is real bad, I used it to shoot the above video. In regular AutoCAD, it still shrinks, but it shrinks a lot less.
Any tips for keeping it floating but making the width stay constant?
I have a photo 36" x 24". I have cropped to 18.5 x 12.5" yet the document size remained the same. Now when I go to print on 13" x 19" paper, only a portion prints because the photo is too big. I shouldn't have to "scale" as then I have no way of confirming that it really will print to the crop dimensions.
Since upgrading to CS6, I have had issues with how the crop is done. For example, why when I open a photo in CS6, the crop tool is already selected by default?
sometimes when trying to manually input the percent number for either layer opacity or image zoom, when I try to type a number I just get a DING sound and it wont allow me to do anything. It goes away after I click a bunch of random things, minimize photoshop and then open it up again. Why does it do this? All I do is click on the percent number, try to input a new number but it sometimes just doesn't allow me to do so. I check all around the document to see if there is anything going on that may interfere but I notice nothing. What is it trying to tell me when it just dings and refuses to change the numbers?
I have a drawing with several dynamic blocks (over 1000 block references) with visibility states. I recently noticed that all of the blocks no longer have the option to change the visibility state (i.e. the upside down blue triangle no longer appears when clicking on the block).
If I insert a new block it comes in with the option to change the visibility state. However, the previously placed blocks still do not have the option of changing the visibilty state. Even if I update the definition of all block references in my drawing nothing changes with the previously placed blocks.
Is there an option/command to bring back the option of changing visibility states on my previously placed blocks?
Basically I am making a new pattern of stars, so I created a 1000 by 1000 document, filled with black, added noise, then added an adjustment layer to thin out the noise and make it look like stars in space. It looks great!
How to save it without the effect changing. I tried flattening the image, and it messed up how I wanted it to look. I tried merging visible, that didn't work. I tried just saving it as a PNG, like I do with all my projects, but that didn't work. And defining a pattern did the exact same thing. I just want to have what I physically see on the screen save as is so I can use it with other things.
The problem is, under Mountain Lion that path doesn't exist. When I go to my user name, there is no "Library" folder at all. Under "Shared" there is an AI Library folder, but it has nothing of any value in it.
My AI startup document (that I've been using for ages) is found here:
However, if I navigate there and make changes, then quit Illustrator and re-launch it, nothing happens. I'm using the same old defaults as before. I know I need to upgrade to a later version of CS, but the prices have become so outrageous there's no way I can justify it as long as AI and PS are working. You need a mortgage to buy new Adobe products these days.
SurfaceBody.GetExistingFacets( ToleranceIndex As Double, VertexCount As Long, FacetCount As Long, VertexCoordinates() As Double, NormalVectors() As Double, VertexIndices() As Long )
This works fine in VBA (Inventor 2014). But when I start using the same in VB.NET (VS 2012) all declaration as long shows as integer and fails on compiling. If I change to integer compile passes but fail on executing in Inventor 2014.
I have a template that I have created, in it I have a rule that changes the stock number and description based on which sheet metal rule is selected. The weird thing is it works correctly if the first sketch is a rectangle. If you sketch a circular shape and make that the face it will not work. It blanks out the values for the stock number and description.
I'd like to change a layer's color from command line because of a user icon. I figured out from previous topics that I should use macro similar to this: ^C^C_filedia;0;-la;s;Verdeckt (ISO);c;1;l;dashed;;_filedia;1;re;
(I want to use this macro to change layer's linetype, too, but that's not the point)
The only problem with this macro: layer's name contains a space therefore Autocad tries to recognize Verdeckt as a command (and macro interrupts there) instead of setting Verdeckt (ISO) as the current layer. I've tried using different quote marks, none of them worked (' and " and <>). I hope there's a method for entering a parameter that contains space.
Software: Inventor Series 2011 SP1 x64 OS: Vista Business x64 CPU: E6400 RAM: 2*2Gb GeIL VGA: Quadro FX 550
PS not letting me edit some random commands before executing them, including Duplicate, Fill, Print Preview, Stroke...possibly others I haven't discovered. When I click the dropdown choice, an edit window used to let me tailor pixel widths, color, etc. (I know, [it's what] 'edit' means). Now, the little eyedropper icon replaces my cursor, all top menus are grey except 'View' and 'Window', I get that awful 'doont!' sound, and my only option is to just hit 'Enter' and it executes the command with whatever preferences I last set before this problem, usually of no present use to me. I have relaunched PS, restarted the computer with no other tasks and relaunched, and impotently shaken my fist at the screen to no avail.
I've a Photoshop droplet with set of actions like:
Open Fit image height:180 width:180 Save as jpeg quality:11 Close
It does it's work as expected but once the actions are executed on all the images in a folder, I'd like to close the Photoshop as well, which looks tricky in Photoshop droplet. Is there anyway to close Photoshop application at last by action? Or is there any option so that droplet actions will be executed without opening the Photoshop window.
In the last 2 days Corel has decided to start changing Artistic Text to Paragraph Text when I copy & paste it across documents, completely changing the font, size & colour of what I am copying.
I've just done a factory reset & it's still doing it.
I don't recall doing anything that would change a setting.
The text I am copy & pasting are disclaimers that are all set on 1 document & I copy & paste them to a proof as needed.
The code below crashes with an "attempt to write to protected memory" in debug mode (it crashes when it hits acDocMgr.add)but in the Release version it works fine. I am using Command Flags.Session
Dim acDocMgr As DocumentCollection = Application.DocumentManager Dim pStyle As Integer = Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("PSTYLEMODE") Dim acDoc As Document = Nothing If pStyle = 1 Then acDoc = acDocMgr.Add("acad.dwt") Else acDoc = acDocMgr.Add("acad -Named Plot Styles.dwt") End If