Перейти к публикации

Разработка приложений для Solidworks


Рекомендованные сообщения

Уважаемые программеры помогите пожалуйста!

:clap_1: Написал программу на Delphi по формированию спецификации по сборочному чертежу SolidWorks и другие полезные проги. Хочу чтобы они запускались из SolidWorks (посредством add-in в DELPHI).

Но у меня возникли следующие пока неразрешимые вопросы:

не могу разобраться как создать свою панель или раздел меню в SW (как работают методы AddMenuItem, AddToolbar) и привязать к ним свои функции из собственной DLL;

(Я создал проект Active Library добавил в него Active Server Object, получил DLL, зарегистрировал ее в системе, прописал CLSID сокласса в разделе реестра HKEY_LOCAL_MACHINE\SOFTWARE\SolidWorks\AddIns. При попытке подключить свою DLL в SW выдается сообщение “DLL невозможно загрузить. Добавление или один из его компонентов отсутствует ”)

Где должны располагаться методы:

- получить ссылку на объект SW,

- создать свою панель

- привязать к созданной панели метод из DLL;

Ссылка на сообщение
Поделиться на других сайтах


Это из АПИ Солида. Ты не все прописал :smile:

I. Registry Requirements

In the registry under HKEY_LOCAL_MACHINE/software/SolidWorks/Applications add a subkey for your application. This subkey should have a value with a value name of "CLSID" and a string containing the unique CLSID of your application.

Under HKEY_CLASSES_ROOT/CLSID your application should have a unique CLSID which matches the CLSID used in step 1. Your CLSID subkey entry should have a value with no name which is a description of your program. This description will be used in the Add-In Manager dialog box and must not exceed three lines of text, or approximately 132 characters.

Your HKEY_CLASSES_ROOT/CLSID entry should have subkey InprocServer32, which should contain the full path and name of your main DLL.

Here is a sample extract from a .REG file:

[HKEY_LOCAL_MACHINE\SOFTWARE\SolidWorks\Applications\Sample Add-In]

"CLSID"="{42CF4A11-CC8F-11d0-9EC3-00609728F9FE}"

[HKEY_CLASSES_ROOT\CLSID\{42CF4A11-CC8F-11d0-9EC3-00609728F9FE}]

@="Sample C++ Add-In for SolidWorks. Illustrates general format required of a SolidWorks Add-In."

[HKEY_CLASSES_ROOT\CLSID\{42CF4A11-CC8F-11d0-9EC3-00609728F9FE}\InProcServer32]

@="c:\\sldworks\\samples\\comuserdll\\i386\\windebug\\userdll.dll"

про функциии

retval = SldWorks.AddMenuItem ( docType, menu, position, callbackModuleAndFcn )

Input:

(long) docType

The document type to which the menu item is to be added.

Input:

(BSTR) menuItem

the menu string (ie - "menuItem@subMenuString@menuString" ). Menus and submenus will be created if they do not already exist.

Input:

(long) Position

Specifies the position at which to add the new menu item. The first item is at position 0. If Position is –1, the new menu item is added to the bottom of the list. This argument specifies the position of the menu-item in relation to its immediate parent menu.

Input:

(BSTR) callbackFcnAndModule

Function to be called when user clicks your menu item (see below.)

Return:

(long) retval

1 if menu item was successfully added, 0 if failure

Syntax (COM)

status = SldWorks->AddMenuItem ( docType, menuItem, position, callbackModuleAndFcn, &retval )

Input:

(long) docType

the document type to which the menu item is to be added.

Input:

(BSTR)menuItem

the menu string (ie - "menuItem@subMenuString@menuString" ). Menus and submenus will be created if they do not already exist.

Input:

(long)position

specifies the position at which to add the new menu item. The first item is at position 0. If Position is –1, the new menu item is added to the bottom of the list. This argument specifies the position of the menu-item in relation to its immediate parent menu.

Input:

(BSTR) callbackFcnAndModule

function to be called when user clicks your menu item (see below.)

Output:

(long)retval

1 if menu item was successfully added, 0 if failure

Return:

(HRESULT)status

S_OK if successful

Remarks

This capability only operates when your application is implemented as a DLL, not as an EXE. In addition, any function to be exposed as a callback from a menu item, must be declared as an EXPORT or included in your .def file.

Почитай АПИ Солида. ТАм вроде все четко расписанно

Ссылка на сообщение
Поделиться на других сайтах

Присоединяйтесь к обсуждению

Вы можете опубликовать сообщение сейчас, а зарегистрироваться позже. Если у вас есть аккаунт, войдите в него для написания от своего имени.
Примечание: вашему сообщению потребуется утверждение модератора, прежде чем оно станет доступным.

Гость
Ответить в тему...

×   Вставлено в виде отформатированного текста.   Вставить в виде обычного текста

  Разрешено не более 75 эмодзи.

×   Ваша ссылка была автоматически встроена.   Отобразить как ссылку

×   Ваш предыдущий контент был восстановлен.   Очистить редактор

×   Вы не можете вставить изображения напрямую. Загрузите или вставьте изображения по ссылке.

  • Сейчас на странице   0 пользователей

    Нет пользователей, просматривающих эту страницу.




×
×
  • Создать...