Format batch example: The following code applies solid red color filling to all selected elements:
C# |
Copy Code
|
---|---|
// create a new format batch associated with the specified document NBatchFormat batchFormat = new NBatchFormat(document); // build it from the view selection batchFormat.Build(view.Selection.Nodes); // check if the style of all batch nodes can be changed if (batchFormat.CanChangeStyle(true)) { // set red fill style to all batch nodes batchFormat.ChangeFillStyle(new NColorFillStyle(Color.Red), true); } |
Visual Basic |
Copy Code
|
---|---|
' create a new format batch associated with the specified document Dim batchFormat As New NBatchFormat(document) ' build it from the view selection batchFormat.Build(view.Selection.Nodes) ' check if the style of all batch nodes can be changed If (batchFormat.CanChangeStyle(True)) Then ' set red fill style to all batch nodes batchFormat.ChangeFillStyle(New NColorFillStyle(Color.Red), True) End If |
Layout batch example: The following code horizontally aligns the selected nodes to the selection anchor left side:
C# |
Copy Code
|
---|---|
// create a new layout batch associated with the specified document NBatchLayout batchLayout = new NBatchLayout(document); // build it from the view selection batchLayout.Build(view.Selection.Nodes); // check if all batch nodes can be aligned to the selection anchor if (batchLayout.CanAlignHorizontally(view.Selection.AnchorNode, true)) { // align the lefts of all batch nodes to the selection anchor left side batchLayout.AlignHorizontally(view.Selection.AnchorNode, HorzAlign.Left, true); } |
Visual Basic |
Copy Code
|
---|---|
' create a new layout batch associated with the specified document Dim batchLayout As New NBatchLayout(document) ' build it from the view selection batchLayout.Build(view.Selection.Nodes) ' check if all batch nodes can be aligned to the selection anchor If (batchLayout.CanAlignHorizontally(view.Selection.AnchorNode, True)) Then ' align the lefts of all batch nodes to the selection anchor left side batchLayout.AlignHorizontally(view.Selection.AnchorNode, HorzAlign.Left, True) End If |
Translate batch example: The following code translates the selected elements and their translation slaves:
C# |
Copy Code
|
---|---|
// create a new translate batch associated with the specified document NBatchTranslate batchTranslate = new NBatchTranslate(document); // build it from the view selection batchTranslate.Build(view.Selection.Nodes); // check if all batch nodes can be translated with the specified amounts if (batchTranslate.CanTranslate(10, 10, false, true)) { // translate all batch nodes with the specified amounts batchTranslate.Translate(10, 10, false, true); } |
Visual Basic |
Copy Code
|
---|---|
' create a new translate batch associated with the specified document Dim batchTranslate As New NBatchTranslate(document) ' build it from the view selection batchTranslate.Build(view.Selection.Nodes) ' check if all batch nodes can be translated with the specified amounts If (batchTranslate.CanTranslate(10, 10, False, True)) Then ' translate all batch nodes with the specified amounts batchTranslate.Translate(10, 10, False, True) End If |
Transform batch example: The following code rotates the selected models to 90 degrees:
C# |
Copy Code
|
---|---|
// create a new transform batch associated with the specified document NBatchTransform batchTransform = new NBatchTransform(document); // build it from the view selection batchTransform.Build(view.Selection.Nodes); // check if all batch nodes can be rotated to 90 degrees if (batchTransform.CanRotate(90, true)) { // translate all batch nodes with the specified amounts batchTransform.Rotate(90, true); } |
Visual Basic |
Copy Code
|
---|---|
' create a new transform batch associated with the specified document Dim batchTransform As New NBatchTransform(document) ' build it from the view selection batchTransform.Build(view.Selection.Nodes) ' check if all batch nodes can be rotated to 90 degrees If (batchTransform.CanRotate(90, True)) Then ' translate all batch nodes with the specified amounts batchTransform.Rotate(90, True) End If |
Delete batch example: The following code deletes all selected elements
C# |
Copy Code
|
---|---|
// create a new delete batch associated with the specified document NBatchDelete batchDelete = new NBatchDelete(document); // build it from the view selection batchDelete.Build(view.Selection.Nodes); // check if the delete operation can be performed if (batchDelete.CanDelete(true)) { ' delete all batch nodes batchDelete.Delete(true); } |
Visual Basic |
Copy Code
|
---|---|
' create a new delete batch associated with the specified document Dim batchDelete As New NBatchDelete(document) ' build it from the view selection batchDelete.Build(view.Selection.Nodes) ' check if the delete operation can be performed If (batchDelete.CanDelete(True)) Then ' delete all batch nodes batchDelete.Delete(True) End If |