Send SLINE command from .net code with Style parameter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am using VB.net customization for Plant3D-PnID 2018 (used in PnID context)
For a specific purpose I'm intending to use SLINE command from a vb.net application.
First I'm getting a number of information related to user operation.
Then, I want the user to trace a SLINE having a LineStyle got from specific rule (from another part of code)
The issue is I do not manage to run SLINE command using a SendStringToExecute with relevant style parameter...
Using the same function as below with no parameters actually works but with wrong style (uses the current one, set from previous commands)
I observed that when using SLINE command manually from Editor panel,
it appears from Editor messages that the "Current sline style" is known prior to enter Command:
>Command: SLINE
>Command:
>Current sline style: FB_Pneumatic
this info is shared at the project level (same value in all opened drawings, and saved with project)
So, I guess another method compared to use parameters from SendStringToExecute()
would be to access this information ("Current sline style") and set it to my selection value prior to start my SendStringToExecute()
But, I could not find any system Variable nor API function to access such "Current sline style" information
To date I've not been successful in any of both methods.
Am I missing something? Any suggestion?
Thanks in advance for help
Here is the function vb.net code:
Private Function ExecuteMyTool(Byval SelectedStyleName as string) as boolean
Dim FunctionStatus as Boolean = False
Try
' Init Helper class (retrieve current active Doc, Database...)
Helper.Initialize()
' Give focus to Working Space
Helper.ActiveDocument.Window.Focus()
' My utility Function to get First Point from User input
Dim StartPoint As Point3d = AutoCadUtilities.GetPoint("Enter Start Point for SLine: ")
' Exit if invalid input from user or cancel
If StartPoint = Nothing Then Exit Try
Dim strStartPoint As String = StartPoint.X & "," & StartPoint.Y & "," & StartPoint.Z
Dim StringToExecute As String = "._" + "SLINE" + " " + SelectedStyleName + " " + strStartPoint + " "
Helper.ActiveDocument.SendStringToExecute(StringToExecute, False, False, False)
' Success
FunctionStatus = True
Catch ex As Exception
MsgBox("Error in ExecuteMyTool: " & ex.Message, MsgBoxStyle.Critical, "Error")
Finally
' Clean up Helper
Helper.Terminate()
End Try
Return FunctionStatus
End Function