What's new

Generic questions

eendrigo

Member
Generic questions

A couple of question :

1) How could by default maximized the new session windows without do it manually ?
2) How can I load an existing part ( *.AD_PRT) into an assembly ?
3) How can I load an existing assembly ( *.AD_ASM) into an assembly ?

4) Equiation editor :

4.1) How many characters could I use for Name
4.2) How many characters could I use for Comment

5) Point and others entities : How many characters could I use for its name ?


Thankyou in advance.

Ezio Endrigo


P.S.

VC++ sample would be apreciated. In any case please indicate which part of API's help I must read.

:roll:
 

indesign

Alibre Super User


1) As far as I know this is still an enhancement request.

2-3) Several ways to get there but try this one. Right click in the cad window and select 'insert part\\subassembly'

4.1) start with a letter and no spaces or special char. from there I have yet to type enough but I stop at 100 in my test

4.2) never got there but tested over 600

5) 259 (unless I counted wrong)
 

alexfranke

Senior Member


In case you're looking for API related answers...

For #1, I don't think you can do it through the API, but I'd probably create the part then use Windows API User32.dll to FindWindow() and send it a WM_SYSCOMMAND to maximize...

For assemblies look into IADAssemblySession, and the Occurrences property of its RootOccurance...

Hope this helps... Gotta get back to work now. :D
-Alex
 

WoodWorks

Alibre Super User


Maximizing session window issue: In the case where you are looking to write an API program to automatically maximize your Alibre window, you can do that with other software. It can be done with Actual Windows Manager, and even Macro Express. I have my system configured to remember the last window size (usually maximized) and have my windows open with that size (all except the HOME window).
This software will automatically accomplish this task while your API program is running so you do not have to program that into your API program.

If you solve these issues, please post your code to the forum to share with others. I am trying to create standardized sections of code to address specific issues, and share these sections with others. Sadly, I am in the process of learning Visual Basic and the API and do not have enough confidence in my coding yet to share anything worthwhile. I am still excited about getting my first program running that sucessfully obtained the current Alibre version number.
 

alexfranke

Senior Member


In the interest of sharing code, here's how to hook the window in C# using the Windows API and tell it to maximize. I wrote it as a class so you can add functionlaity as necessary.

To try it out, open a new instance of Notepad, be sure it's not maximized, and add this to your code:

Code:
WinAPI.Windows.Maximize(\"Untitled - Notepad\");
Here's the class file:

Code:
using System;
using System.Runtime.InteropServices; 

namespace WinAPI
{
	public sealed class Windows
	{
		private const int WM_SYSCOMMAND = 0x0112;
		private const int SC_MAXIMIZE = 0xF030;

		[DllImport( \"User32.dll\" )]
		private static extern Int32 FindWindow( String lpClassName, String lpWindowName );
		[DllImport( \"user32.dll\" )]
		private static extern int SendMessage( IntPtr hWnd, int Msg, int wParam, int lParam );

		public static void Maximize( string title )
		{
			int hWnd = FindWindow( null, title );
			SendMessage( (IntPtr)hWnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0 );
		}
	}
}

Cheers,
Alex
 

eendrigo

Member


Thanks Alex and Kelsey for your help!

Regarding your code, Alex, looking for a window refering to its title (CWnd::GetWindowText()) just works for a window with that specific title string. What I need is a code that executes from inside a window maximizing it, regardless of its name.

A correlated issue is the specific language:
For example "Untitled - Notepad" in Italian is "Senza titolo - Blocco note".

I very much appreciate your help, may be i could make clear what I actually need.

Any hints?

Ezio.

:roll:
 

alexfranke

Senior Member
Re:

eendrigo said:
looking for a window refering to its title (CWnd::GetWindowText()) just works for a window with that specific title string.
Yes, in fact you'll only get the topmost window with that title. But don't you know the title of the windows you're creating? (Or are you not creating a window?) You can also call this funtion with the class of the window.

What I need is a code that executes from inside a window maximizing it, regardless of its name.
This sounds like you want to maximize the window that's running your code -- wouldn't you just set its window splacement wiht showmaximized?

A correlated issue is the specific language:
For example "Untitled - Notepad" in Italian is "Senza titolo - Blocco note".
Should work no matter the language... (e.g. WinAPI.Windows.Maximize("Senza titolo - Blocco note"); )

I suppose another option would be to set a systemwide hook. Or maybe I'm just totally misunderstanding wha tyou're trying to accomplish... :roll:

ANyway, please let us know if you figure it out. :)

Cheers,
Alex
 
Top