AutoCAD .NET :: Force Modeless Form To Keep Focus?
Mar 20, 2011how I could force a modeless form to keep focus. There is a sample on the ObjectARX docs but I can find anything for Dot Net.
View 3 Replieshow I could force a modeless form to keep focus. There is a sample on the ObjectARX docs but I can find anything for Dot Net.
View 3 RepliesI want to AutoCAD do not lock it's space, when my Form is shown on display. But I have an exception when I use modeless dialog.
public void MyCommand ()
{
//-------------------------------------------------
// Using this code, my program works fine, but locks modal space of AutoCAD
System.Windows.Forms.Application.EnableVisualStyles ();
System.Windows.Forms.Application.Run (new Form1 ());
// I want to use this instruction to do not lock modal space
// Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog (new Form1 ());
//-------------------------------------------------
}
If I use modeless dialog I can read and write from acad prompt and create block; BUT I can't create BlockReference.
I get an exception "eLockViolation" in the next code instructions:
//------------------------------------------------------------------------------------------------------------------------------
public void CreateBlockReference (string strBlockName, Point3d Origin) {
using( Transaction t = db.TransactionManager.StartTransaction () ) {
BlockTable btTable = (BlockTable)t.GetObject (db.BlockTableId, OpenMode.ForRead); // <--- EXCEPTION
[Code] ..........
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 to switch focus to AutoCAD document window from my form of C# .NET plug-in.
After user pressed the button, I invite him to input a point, but my form still on top.
And it is nessesary to press minimize button, next to set a Focus on Autocad window, then to pick a point.
It is not handy enough.
I did not find a property to set a focus in class of Application.MainWindow.
Is it possible to keep a modeless dialog box permanently open (aside) just like a properties or tool pallete dialog box?If Yes, by keeping permanently, can I work in autocad environment normally as usual, like save, edit, close and open other drawings?
Note: Just assume that I am making a calculator-like dialog box. I would like to keep it open till the autocad application closes? (even in zero document mode.)
I want to create a modeless dialog box that is associated with Excel instead of AutoCAD. The program will run in AutoCAD and then it will open an instance of Excel. I want the ability for the user to then select a button on the modeless dialog that will import in data from the Excel Worksheet into AutoCAD. My preference is for the modeless dialog to be shown in Excel and not necessarily be tied to AutoCAD.
View 1 Replies View RelatedI have modeless dialog. On dialog I have button on which user clicks, when he wants to pick insertion point. Problem is when I exit dialog the command line is still in command GetPoint (doesn't show usual Command.My code at the moment is:
// this.Visible = false;
AppServ.Document adoc = AppServ.Application.DocumentManager.MdiActiveDocument;
AppServ.DocumentLock dl = adoc.LockDocument();
Editor ed = adoc.Editor;
using (ed.StartUserInteraction(this))
{
[code]....
I am using acad 2012, and VS 2010 (C#) on win 7 64 bit.
I made a form, and showing it as modeless via Application.ShowModelessDialog... as recommended by everyone and that works fine.
I have a button that does something, and I set a break point right on the first line of code for its callback.
The button runs fine, but VS is not stopping at the break point.
Is there a different technique required when debugging modeless forms?
[URL]
One of the features I was really looking forward to in CS6 was creating fillable forms with ONE application. I created a form following the step by step instructions in classroom in a book for CS6. When I opened the exported form in Reader X, I get a "This operation is not permitted" error. I opened the completed "end" document in the lesson to make sure I didn't commit an error, and I got the same message when exporting. I have looked for places in menus to modify security restrictions and I can't find any. I installed the updates and that didn't solve the issue.
I saw one solution posted which is to open the document in Acrobat, then do a "save as" option. Is there anything we can do that doesn't involve buying additional software? If this is not the case, then Adobe seriously needs to change its training and advertising about this functionality.
I am working on a form (global) and have added a picture with a parameter and a picture folder underneath. So that the picture displayed on my form will change depending on the parameter value.Here comes the trick. Only text parameters can be used!On the form editor only 'Text parameter' can be selected to drive the picture selection. I actually need an integer, so that i can use my User/Excel parameters from Inventor.
I can work this around with an iLogic rule to equal the value of my string Picture Parameter with the relevant integer Inventor parameter, but the rules need to be run before the pic and the form updates (by pressing the 'Apply' button at the bottom of the form and then the assy updates too. So this takes a couple of minutes)... whereas if it was an option on the form editor then the update would be instant without waiting for everything to update...
Is there a particular reason why the Picture Parameter only can be a text parameter?
In this lesson we will consolidate code to prevent code reuse. Follow along as we demonstrate by doing the following and more:
Apply a color to a form command button, loop form controls, and save and get the color from registry
Part 2 of 7
cs_setInnerHtml('video_43f4e134-ee93-489d-ba2f-80042d243821','');
[URL]
I have a VBA program that I'm converting to VB.Net. The program is a batch process that opens a an excel file, opens a template drawing, adds blocks (listed in the excel file), plots and saves the drawing, then moves on to the next drawing, and so on. In Autocad 2008 and previous version, the program ran in the background, i.e. I could see what was happening, but it didn't affect the running of other programs (like email). However, since switching to Autocad 2009 (and 2010, and now 2011), the very same program now steels focus every time a new drawing is created (every few seconds). We've been running this program for years during normal business hours, but have had to change to running them on a remote VM (which is slower) or at night.
I have since converted the program to vb.net, but I get the same results; windows or autocad keeps returning the focus to the autocad interface. When I originally started to covert this program, I was going to do everything in the database only (not the user interface), it appears that to plot, though, the drawing must be opened in the interface.
I can still run the same VBA program in 2008 or 2007 (if I re-install them) and it will run without steeling focus, but the 2007 file format is slightly larger and adds up with the thousands of drawings we are dealing with. And I want to move to vb.net and 2011.
Ever tried filleting a model and noticed this annoying behavior. You want to type in 0.25... So you typed 0 first, then typed point, then 2. You are now going to type the remaining part 5. You notice that 5 replaces all the numbers in the dialog box. All of a sudden now inventor thinks the fillet value is 5.
Bad part is that this is a huge casting model and 5 is too big and inventor is now frozen.
Inventor Professional 2013
Vault Collaboration 2013
I had made a short function I AutoCAD that generates a user definable toolbar. The toolbar is placed using the
acToolbarDockLeft, acToolbarDockRight , acToolbarDockTop , acToolbarDockFloating
Methods of which I chose acToolbarDockFloating all nice but because floating hasn’t been saved in a workspace (yet) means that the toolbar is placed in the top left corner. To cut a series of tests and playing round with lisp and scripts and the likes I'm after a way of simply forcing the new toolbar in the dead centre of the screen using VBA.
I have googeld and the likes but cant find anything that resembles like
ObjToolbr.Dock acToolbarDockFloating 200, 200
(Presuming the location of the toolbar I want to force is 200 by 200)
Our company is using 2012Lt and has a couple (3) regular templates we use. The problem is I have to keep going back to the templates and clean them out (txt styles, layers, etc) and what I suspect is happening is that someone starts a new dwg does some work and the auto save kicks in before they "save as".
Question, is there a way to force someone to "Save As' immediately after they start a new dwg?
I am trying to make a simple app using .NET classes.
I made a simple Windows.Form in which are check boxes (on for each layer of the CAD drawing).
Just to set the visibility of each layer. Everything is working fine, but I have a little problem with refreshing a drawing.
Changes of visibility settings are applied after a form is closed.
I need the drawing to be refreshed after every check box check change.
I enclose a method with handles check boxes changes.
private void LayerCheckedChanged(object sender, EventArgs e)
{
CheckBox s = sender as CheckBox;
[Code].....
I have a bunch of drawings for which I have to reload the linetypes (they have to be redefined, for example pneumatic line has a new definition but the drawing has an older one). Is there a way other than rename the old linetypes, then load the newer version, then iterate through all objects and change the linetype to the newer version?
View 2 Replies View RelatedIs it possible to set a time delay on an applied force in simulation 2012? I would like to apply a force for a set amount of time?
View 5 Replies View RelatedI want to force a saveas from an external app using code as below:-
If OApp.Ready Then
Try
Call oDoc.SaveAs(File_Full_Name, True)
......
However, Inventor invariably crashes at this point - especially if panning a model. Is there a way I can either lock Inventor from the user whilst the save is happening or check that no mouse or keyboard activity is in use?
I have tried monitoring the status bar text for "Ready" but tihs is unreliable.
I have a issu when i use BindXRef. I have 4 XREF in my dwg. so i use à Do / While for each XREF i have found. It work fine but whrn the Xref is big File, i have the issue "Out Of memory".
So the question : How i can Force the GC to clear all memory not used. My Think is to force the GC to Clear the memory before to use BindXRef() with only one XRef before to BindXRef with another.
Here my code :
Dim LockDoc As DocumentLock = doc.LockDocument Dim MemNumBoucle As Integer = -1 Dim CollXRef As New ObjectIdCollection Do CollXRef.Clear() Dim xg As XrefGraph = db.GetHostDwgXrefGraph(True) Dim root As GraphNode = xg.RootNode Using tr As Transaction = db.TransactionManager.StartTransaction For o = 0 To root.NumOut - 1 Step 1 Dim child As [Code]......
In this example i cant BindXREf ('R+1') alone. I need to BindXRef('ARCHI') before
If there is a way to force the dimension of a line or circle or anything.
For example: If I draw a line and dimension it, it will dimension it to 2.973 let's say, but if I want to change the dimension or the line to 3.300, how would I do that?
Also, after you create a 2D drawing, is there a way to make it a 3D model or extrude the model?
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:
Application.DocumentManager.MdiActiveDocument = aGeneratedDrawing;
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:
Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog(aForm);
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 use standard Acad-functions or even simply select an object like a polyline from land-survey,the "ribbon" changes to the corresponding Topic of the object,and the Map3D window looses its focus. (normal windows-mouse-cursor is displayed, not the AutoCAD crosshair). After clicking in Map 3D window again, crosshair reappears,and work can continue.
It doesn't matter if Map3d-windows is in windowed mode or fullscreen,it also doesn't matter if the windows is only on one of my 2 monitors or on both.
didn't have this problems using Topobase Client 2009,2010,2011...but since 2012 few problems evolved... (drawing-order-bug, memory-leak problem etc. etc.)
How can I force all users in a domain to load the same add-ins with Inventor Professional 2012?
View 3 Replies View RelatedHow to force the text to move in a particular direction as the “annotation scale” changes?
I wanted to force the text to move in a particular direction as the “annotation scale” changes but sounds not to respond. I tried to play with the “justify” but seems not to have an effect!
How to control this movement direction of the text as the annotation scale changes?
Software: AutoCAD 2014, AutoCAD C3D, AutoCAD M3D, Revit
Windows 7 (Ultimate 64 bits),
Firefox 20.0,
Kaspersky 2013.
When I click the Force command in the LOADS panel when doing a Frame Analysis, I don't get a dialog box. All I get is a select origin box with an arrow. There is no way to change the Magnitude value or the Angle of Plane as per instructions in the tutorial. I have tried numerous ways to get a dialog box to appear, but I can't find out how. why I am not getting a Dialog box?
View 1 Replies View RelatedTying to Batch Plot to a PDF file and make the lines and text show Black not in colors. How to force colors to Black while Batch plotting to a PDF?
View 3 Replies View RelatedI am wanting to use pressure pipes for force main. If you do how do you add an air release manhole? I tried to use an appurtenance part as an air release manhole. If I set the plan display to use a block it skews the block. For the appurtenance part I do not see that the pipe inverts are available for the pipe label. I thought pressure pipes would be for water mains and force mains. So, I am wondering what others do for Force main Pipes?
View 3 Replies View RelatedI have created an acad.lsp file in where I want to arrange all our company settings. I've stored it on the network to make sure everyone will use the same one and when updates take place I don't have to run past all pc's to change it. I've set everything in the deployment package but users can still change it when they reset their profile. Plus some pc's are already installed with AutoCAD before creating the lisp routine, how can I enforce the support directory to check on the network for the acad.lsp each time?
View 9 Replies View RelatedI have a question regarding adding a force constraint in the Inventor frame analysis environment. When I add the fixed constraint to the beam the orientation indicator is incorrect - the square indicator being not parallel to the base of the beam. I would like to know why this is and as I am relatively new to frame analysis if I am doing something wrong. I have attached a screen shot of the placement of the constraint on the beam.
Autodesk Inventor Professional 2013 SP2 64-Bit Edition
Windows 7 HP Z400, Intel Xeon W3550 3.07GHz
12.0GB RAM, ATI FirePro V4800 (FireGL)
I would liketho know how it is done / is there a command for that, lisp.
View 1 Replies View Related