CreateCustomObject Objects - Custom 

Declaration:

FUNCTION   CreateCustomObject
(   objectName :STRING;
    pX :REAL;
    pY :REAL;
    rotationAngle :REAL
) :HANDLE ;

Description:

Creates a custom object instance at the specified location and angle of rotation. For the objectName, use the "internal" plug-in name (the one assigned in the plug-in editor), as opposed to the filename (which can be different).

Parameters:

objectName Name of object.
p Insertion point of object instance.
rotationAngle Rotation angle (in degrees) of object instance.

Result:

Returns a HANDLE to the new object.

See Also:

CreateCustomObjectPath  



  CreateCustomObjectN Objects - Custom 

Declaration:

FUNCTION   CreateCustomObjectN
(   objectName :STRING;
    pX :REAL;
    pY :REAL;
    rotationAngle :REAL;
    showPref :BOOLEAN
) :HANDLE ;

Description:

Creates a custom object instance at specified location and angle of rotation. The calling function can also set whether the pref dialog should appear.

Parameters:

objectName Name of object.
p Insertion point of object instance.
rotationAngle Rotation angle (in degrees) of object instance.
showPref Show the Object Properties dialog.

Example:

PROCEDURE Example;
VAR
   h :HANDLE;
BEGIN
   h := CreateCustomObjectN('Door', 0, 0, 0, False);
END;
RUN(Example);



  CreateCustomObjectPath Objects - Custom 

Declaration:

FUNCTION   CreateCustomObjectPath
(   objectName :STRING;
    path :HANDLE;
    profileGroup :HANDLE
) :HANDLE ;

Description:

Creates an instance of the path custom object specified by the name argument. The vertices of the path are translated in such a way that the first vertex will be placed at the origin of the plug-in's coordinate space.

Parameters:

objectName Name of object.
path Handle to new object path polygon.
profileGroup Handle to new profile group object.

Result:

Returns a HANDLE to the new path object.

Example:

PROCEDURE Example;
VAR
	h :HANDLE;
BEGIN
	CallTool(-204);
	h := CreateCustomObjectPath('Cutting Plane', FSActLayer, nil);
END;
RUN(Example);



  EnableParameter Objects - Custom 

Declaration:

PROCEDURE   EnableParameter
(   inPlugin :HANDLE;
    inParameterName :STRING;
    inSetEnabled :BOOLEAN
) ;

Description:

For plug-in objects, this procedure sets whether or not the specified parameter is enabled on the Object Info Palette. This routine is used inside plug-in object regeneration scripts to set their parameter enable state. This state is an object instance property.

Parameters:

inPlugin Handle to the currently executing plug-in object.
inParameterName Name of parameter, as it appears in the plug-in editor's parameter list.
inSetEnabled Enabling flag.



  GetCustomObjectChoice Objects - Custom 

Declaration:

FUNCTION   GetCustomObjectChoice
(   objectName :STRING;
    parameterName :STRING;
    choiceIndex :INTEGER
) :STRING ;

Description:

Function GetCustomObjectChoice returns a choice string of the specified plug-in object popup menu or radio group parameter. These parameters are displayed in the Object Info palette or the plug-in objects' creation dialog.

The string passed into the parameter name argument should use the parameter constant syntax, not the actual parameter name. The string should have the prefix character 'P', and should have all spaces replaced with underscore characters. For example, a parameter Jamb Depth would have a constant declared as PJAMB_DEPTH and therefore the parameter name argument to this function should be the string 'PJAMB_DEPTH'.

The choiceIndex parameter should be passed an integer between 1 and the number of choices, which can be determined by calling the NumCustomObjectChoices function.

Parameters:

objectName Name of the plugin object.
parameterName String indicating which parameter.
choiceIndex Index of desired choice.

Result:

Returns associated string of specified choice list item.

Example:

theChoice := GetCustomObjectChoice(objectName, 'PDINNER_MENU', 1);

See Also:

NumCustomObjectChoices  



  GetCustomObjectColor Objects - Custom 

Declaration:

FUNCTION   GetCustomObjectColor
(   objectHand :HANDLE;
    inTagID :INTEGER;
  VAR  outColorIndex :INTEGER
) :BOOLEAN ;

Description:

Get an auxilary color index stored in'objectHand' previously with SetCustomObjectColor . Aplication will preserve the color mapped to inTagID.

Parameters:

objectHand Handle to object.

Result:

Returns TRUE if the operation was successful.

Example:

PROCEDURE Example;
VAR
	objName :STRING;
	objHand, recHand, wallHand :HANDLE;
	colorIndexBefore, colorIndexAfter :INTEGER;
	boo :BOOLEAN;
BEGIN
	IF GetCustomObjectInfo(objName, objHand, recHand, wallHand) THEN BEGIN
		RGBToColorIndex(pRed, pGreen, pBlue, colorIndexBefore);
		Rect(0, 0, 1, 1);
		SetFillBack(LNewObj, colorIndexBefore);
		IF SetCustomObjectColor(objHand, 1, colorIndexBefore) THEN BEGIN
			boo := GetCustomObjectColor(objHand, 1, colorIndexAfter);
			AlrtDialog(Concat('before: ', colorIndexBefore, Chr(13), 'after: ', colorIndexAfter));
		END;
	END;
END;
RUN(Example);

See Also:

SetCustomObjectColor  



  GetCustomObjectInfo Objects - Custom 

Declaration:

FUNCTION   GetCustomObjectInfo
( VAR  objectName :STRING;
  VAR  objectHand :HANDLE;
  VAR  recordHand :HANDLE;
  VAR  wallHand :HANDLE
) :BOOLEAN ;

Description:

Function GetCustomObjectInfo is used within plug-in object scripts to determine information about the object. Only returns false if the object is corrupt.

Parameters:

objectName Returns the name of the object.
objectHand Returns a handle to the plugin object in the drawing.
recordHand Returns a handle to the record containing current parameter values.
wallHand Returns a handle to a wall, (if this object is in a wall).

See Also:

IsNewCustomObject  



  GetCustomObjectPath Objects - Custom 

Declaration:

FUNCTION   GetCustomObjectPath
( objectHand:HANDLE ) :HANDLE ;

Description:

Returns a handle to the path polygon of a path custom object.

Parameters:

objectHand Handle to object.

Result:

Returns a HANDLE to the path polygon.

See Also:

SetCustomObjectPath  



  GetCustomObjectProfileGroup Objects - Custom 

Declaration:

FUNCTION   GetCustomObjectProfileGroup
( objectHand:HANDLE ) :HANDLE ;

Description:

Returns a handle to the profile group of a path custom object.

A path object has two "containers" for storing subordinate objects: the path, and the profile. As an example, if a path object is going to do an extrude along path, it will store the path in the path container, and the shape to be extruded in the profile container. The code within the object will then supply the handles to the path and the profile to the CreateExtrudeAlongPath call.

Parameters:

objectHand Handle to path custom object.

Result:

Returns a HANDLE to the profile group.

See Also:

SetCustomObjectProfileGroup  



  GetCustomObjectSelectionGroup Objects - Custom 

Declaration:

FUNCTION   GetCustomObjectSelectionGroup
( objectHand:HANDLE ) :HANDLE ;

Description:

Access the handle to selection group. This group contains geometry that defines the selection and pre-selection indication of this object.

Parameters:

objectHand Handle to custom object.

Result:

Returns a HANDLE to the selection group.



  GetCustomObjectWallHoleGroup Objects - Custom 

Declaration:

FUNCTION   GetCustomObjectWallHoleGroup
( objectHand:HANDLE ) :HANDLE ;

Description:

Access the handle to wall hole group. This group contains geometry that defines the opening that will be cut into the wall for this parametric object.

Parameters:

objectHand Handle to custom object.

Result:

Returns a HANDLE to the wall hole group.



  GetLocalizedPluginChoice Objects - Custom 

Declaration:

FUNCTION   GetLocalizedPluginChoice
(   inPluginName :STRING;
    inParameterName :STRING;
    inChoiceIndex :INTEGER;
  VAR  outChoice :STRING
) :BOOLEAN ;

Description:

Returns true with outChoice as specified by inPluginName, inParameterName and inChoiceIndex. Each of the input names are universal names.

Parameters:

inPluginName The universal name of the plug-in.
inParameterName The universal name of the parameter.
inChoiceIndex The index of the requested choice. ( range is 1 to n)
outChoice The requested choice string.

Result:

Returns true if the function call succeeded.

See Also:

GetLocalizedPluginName  



  GetLocalizedPluginName Objects - Custom 

Declaration:

FUNCTION   GetLocalizedPluginName
(   inPluginName :STRING;
  VAR  outName :STRING
) :BOOLEAN ;

Description:

Get the localized name of a plug-in given its universal name.

When Vectorworks plug-ins are localized by distributors in other countries, their names are translated to the appropriate language. The plug-in file stores both the original universal name and this translated localized name. The translated name is displayed by the Vectorworks user interface instead of the original name. If a script needs to display the name of a plug-in in a dialog or message then it should call this function to determine the localized name. (Note that scripts will use the universal name to specify a plug-in when the name is not being displayed to the user.)

If the plug-in has not been localized, then this function will return the universal name.

Parameters:

inPluginName Universal name of the plug-in.
outName The localized name of the plug-in

Result:

Returns true if the specified plug-in exists, and false if it is not found.

Example:

PROCEDURE Example;
TYPE
	plugin = STRUCTURE
		universalName :STRING;
		localizedName :STRING;
		params :ARRAY[1..99,1..2] OF STRING;
		popups :ARRAY[1..99,1..99] OF STRING;
	END;
VAR
	plugins :ARRAY[1..99] OF plugin;
	cnt1, cnt2, cnt3, pluginCnt :INTEGER;
	str1, str2, str3, str4 :STRING;
	boo :BOOLEAN;
	int1, int2 :INTEGER;
	
PROCEDURE GetInfo(h :HANDLE);
VAR
	recHand :HANDLE;
	recName :STRING;
BEGIN
	recHand := GetRecord(h, NumRecords(h));
	recName := GetName(recHand);
	FOR cnt1 := 1 TO pluginCnt DO 
		IF recName = plugins[cnt1].universalName 
			THEN cnt1 := pluginCnt + 2;
	IF cnt1 < pluginCnt + 2 THEN BEGIN
		boo := GetLocalizedPluginName(recName, str2);
		pluginCnt := pluginCnt + 1;
		plugins[pluginCnt].universalName := recName;
		plugins[pluginCnt].localizedName := str2;
		FOR cnt2 := 1 TO NumFields(recHand) DO BEGIN
			str1 := GetFldName(recHand, cnt2);
			int1 := GetFldType(recHand, cnt2);
			boo := GetLocalizedPluginParameter(recName, str1, str2);
			plugins[pluginCnt].params[cnt2, 1] := str1;
			plugins[pluginCnt].params[cnt2, 2] := str2;
			IF int1 = 8 THEN BEGIN
				FOR cnt3 := 1 TO NumCustomObjectChoices(recName, str1) DO BEGIN
					str3 := GetCustomObjectChoice(recName, str1, cnt3);
					boo := GetPluginChoiceIndex(recName, str1, str3, int2);
			  		boo := GetLocalizedPluginChoice(recName, str1, int2, str4);
			  		plugins[pluginCnt].popups[cnt2, cnt3] := Concat(str3, Chr(9), str4);
				END;
			END;
		END;
	END;
END;

BEGIN
	pluginCnt := 0;
	ForEachObject(GetInfo, (T=86));
	FOR cnt1 := 1 TO pluginCnt DO BEGIN
		WriteLn(plugins[cnt1].universalName, Chr(9), plugins[cnt1].localizedName);
		cnt2 := 1;
		WHILE plugins[cnt1].params[cnt2, 1] <> '' DO BEGIN
			WriteLn('    ', plugins[cnt1].params[cnt2, 1], Chr(9), plugins[cnt1].params[cnt2, 2]);
			cnt3 := 1;
			WHILE plugins[cnt1].popups[cnt2, cnt3] <> '' DO BEGIN
				WriteLn('        ', plugins[cnt1].popups[cnt2, cnt3]);
				cnt3 := cnt3 + 1;
			END;
			cnt2 := cnt2 + 1;
		END;
	END;
END;
RUN(Example);

See Also:

GetLocalizedPluginParameter   GetLocalizedPluginChoice  



  GetLocalizedPluginParameter Objects - Custom 

Declaration:

FUNCTION   GetLocalizedPluginParameter
(   inPluginName :STRING;
    inParameterName :STRING;
  VAR  outParameter :STRING
) :BOOLEAN ;

Description:

Get the localized name of a plug-in parameter.

When Vectorworks plug-ins are localized by distributors in other countries, their parameter names are translated to the appropriate language. The plug-in file stores both the original universal name and this translated localized name for each parameter. The translated name is displayed by the Vectorworks user interface instead of the original name. If a script needs to display the name of a plug-in parameter in a dialog or message then it should call this function to determine the localized name. (Note that scripts will use the universal name to specify a plug-in parameter when the name is not being displayed to the user.)

If the plug-in has not been localized, then this function will return the universal name of the parameter.

Parameters:

inPluginName Universal name of the plug-in.
inParameterName Universal name of the parameter.
outParameter Localized name of the parameter.

Result:

Returns true if the specified plug-in exists, and false if it is not found.

See Also:

GetLocalizedPluginName  



  GetPluginChoiceIndex Objects - Custom 

Declaration:

FUNCTION   GetPluginChoiceIndex
(   inPluginName :STRING;
    inParameterName :STRING;
    inChoiceName :STRING;
  VAR  outIndex :INTEGER
) :BOOLEAN ;

Description:

Returns true with outIndex as specified by inPluginNameand inParameterName. Each of the input names are universal names.

Parameters:

inPluginName The universal name of the plug-in.
inParameterName The universal name of the parameter.
inChoiceName The universal name of the choice.
outIndex The index of the requested choice. ( range is 1 to n)

Result:

Returns true if the function succeeded.



  GetPluginInfo Objects - Custom 

Declaration:

FUNCTION   GetPluginInfo
( VAR  pluginName :STRING;
  VAR  recordHand :HANDLE
) :BOOLEAN ;

Description:

Returns the name and attached parameter record of the currently executing plug-in. Use with menu command or tool item plug-ins.

Parameters:

pluginName Name of plug-in.
recordHand Handle to parameter record of plug-in.



  GetPluginString Objects - Custom 

Declaration:

FUNCTION   GetPluginString
( stringIndex:INTEGER ) :STRING ;

Description:

Returns the string specified by stringIndex. The strings are created using the "Strings" button in the plug-in editor.

Parameters:

stringIndex The index of the string as represented in the plug-in editor.

Result:

The requested string.



  HasPlugin Objects - Custom 

Declaration:

FUNCTION   HasPlugin
(   itemUniversalName :STRING;
  VAR  PaletteName :STRING
) :BOOLEAN ;

Description:

Returns whether tool item or menu command is in current workspace.

Parameters:

itemUniversalName Universal name of the plug-in
PaletteName If plug-in is a tool, and is found in the workspace, the name of the palette in which it is contained will be returned in this parameter

Result:

Returns true if the plug-in is found in the workspace; false otherwise.



  IsNewCustomObject Objects - Custom 

Declaration:

FUNCTION   IsNewCustomObject
( objectName:STRING ) :BOOLEAN ;

Description:

Function IsNewCustomObject returns whether the specified plug-in object is a new object, indicating that the object is being regenerated for the first time.


New object status is useful in specifying initialization and setup data, as well as calling initialization specific subroutines. This function should only be called in plug-in objects.



Parameters:

objectName Name of plugin object.

See Also:

GetCustomObjectInfo  



  IsPluginFormat Objects - Custom 

Declaration:

FUNCTION   IsPluginFormat
( theFormat:HANDLE ) :BOOLEAN ;

Description:

Determines if the format node is used for the parameters of a plug-in object, plug-in tool or plug-in menu command.

Parameters:

theFormat Handle to the format node in question.

Result:

Returns true if format is used by a plug-in and false if it is a regular format that may have been created by the user.



  NumCustomObjectChoices Objects - Custom 

Declaration:

FUNCTION   NumCustomObjectChoices
(   objectName :STRING;
    parameterName :STRING
) :INTEGER ;

Description:

Function NumCustomObjectChoices returns the number of choice strings for a specified popup menu or radio group parameter in a plug-in object.

The string passed into the parameter name argument should use the parameter constant syntax, not the actual parameter name. The string should have the prefix character 'P', and should have all spaces replaced with underscore characters. For example, a parameter Jamb Depth would have a constant declared as PJAMB_DEPTH and therefore the parameter name argument to this function should be the string 'PJAMB_DEPTH'.

Parameters:

objectName Name of plugin object.
parameterName String indicating which parameter

Example:

maxChoices := NumCustomObjectChoices(objName, 'PDINNER_MENU');

See Also:

GetCustomObjectChoice  



  SetCustomObjectColor Objects - Custom 

Declaration:

FUNCTION   SetCustomObjectColor
(   objectHand :HANDLE;
    inTagID :INTEGER;
    inColoIndex :INTEGER
) :BOOLEAN ;

Description:

Store/Set an auxilary color index in 'objectHand' so GetCustomObjectColor can access it later. Application will preserve the color mapped to inTagID.

Parameters:

objectHand Handle to object.

Result:

Returns TRUE if the operation was successful.

See Also:

GetCustomObjectColor  



  SetCustomObjectPath Objects - Custom 

Declaration:

FUNCTION   SetCustomObjectPath
(   objectHand :HANDLE;
    path :HANDLE
) :BOOLEAN ;

Description:

Replaces the path of an existing path plug-in object. The path is used as-is; no translation of vertices is performed.

Parameters:

objectHand Handle to object.
path Handle to new path polygon.

Result:

Returns TRUE if the operation was successful.

Example:

PROCEDURE Example;
VAR
	dialog1  :INTEGER;
	objName  :STRING;
	objHand  :HANDLE;
	pathHand :HANDLE;
	boo      :BOOLEAN;
	int      :INTEGER;

PROCEDURE dialog1_Setup;
BEGIN
	dialog1 := CreateLayout('Pick Object to Create', FALSE, 'OK', 'Cancel');
	CreatePulldownMenu(dialog1, 4, 28);
	SetFirstLayoutItem(dialog1, 4);
END;

PROCEDURE dialog1_Handler(VAR item :LONGINT; data :LONGINT);
BEGIN
	CASE item OF
		SetupDialogC:
			BEGIN
				InsertChoice(4, 0, 'Ceiling Grid');
				InsertChoice(4, 1, 'Space');
				InsertChoice(4, 2, 'Piping Run');
			END;
		1: GetSelChoice(4, 0, int, objName);
	END;
END;

BEGIN
	pathHand := FSActLayer;
	dialog1_Setup;
	IF RunLayoutDialog(dialog1, dialog1_Handler) = 1 THEN BEGIN
		objHand := CreateCustomObjectN(objName, 0, 0, 0, FALSE);
		boo := SetCustomObjectPath(objHand, pathHand);
	END;
END;
RUN(Example);

See Also:

GetCustomObjectPath  



  SetCustomObjectProfileGroup Objects - Custom 

Declaration:

FUNCTION   SetCustomObjectProfileGroup
(   objectHand :HANDLE;
    profileGroupHand :HANDLE
) :BOOLEAN ;

Description:

Sets the profile group for a path custom object.

Parameters:

objectHand Handle to object.
profileGroupHand Handle to profile group.

Result:

Returns TRUE if the operation was successful.

See Also:

GetCustomObjectProfileGroup  



  SetCustomObjectSelectionGroup Objects - Custom 

Declaration:

FUNCTION   SetCustomObjectSelectionGroup
(   objectHand :HANDLE;
    selGroup :HANDLE
) :BOOLEAN ;

Description:

Set selection indication geometry for a parametric object.

Parameters:

objectHand Handle to parametric object.
selGroup Handle to object or group that contains geometry for selection indication.

Result:

Returns TRUE if the operation was successful.



  SetCustomObjectWallHoleGroup Objects - Custom 

Declaration:

FUNCTION   SetCustomObjectWallHoleGroup
(   objectHand :HANDLE;
    holeGroup :HANDLE
) :BOOLEAN ;

Description:

Set wall hole geometry for a parametric object.

Parameters:

objectHand Handle to parametric object.
holeGroup Handle to object or group that contains geometry for wall hole.

Result:

Returns TRUE if the operation was successful.



  SetParameterVisibility Objects - Custom 

Declaration:

PROCEDURE   SetParameterVisibility
(   inPlugin :HANDLE;
    inParameterName :STRING;
    inSetVisible :BOOLEAN
) ;

Description:

For plug-in objects, this procedure sets whether or not the specified parameter is visible on the Object Info Palette. This routine is used inside plug-in object regeneration scripts to set their parameter visibility. This visibility is an object instance property.

Parameters:

inPlugin Handle to the currently executing plug-in object.
inParameterName Name of parameter, as it appears in the plug-in editor's parameter list.
inSetVisible The new visibility state for the parameter specified.