RhinoScript - passing variables to Rhino.Command

I’m basically trying to cut down on the number of steps it takes to use the Rotated Dimension command (as well as build skills for future tasks). I’ve tried a TON of different things and cannot get the command function to recognize any point values I’ve obtained from the GetPoint methods. The code below is where I gave up, not necessarily indicative of the direction or approach I need to take.
I’ve looked up various examples and none really mirror what I’m trying to do. I see scripts where the authors have successfully put actual numbers (opposed to variables) into Rhino.Command, but dealing with variables thus far… no luck.

There is no AddRotatedDimension method (although I believe it exists for other methods).

Basically, I just need to be able to pass points stored as variables in any way, shape or form to the command line, but so far no luck.

Option Explicit
'Script written by <insert name>
'Script copyrighted by <insert company name>
'Script version Monday, 11 October 2021 11:24:03

Call Main()
Sub Main()
	
	Dim arrPT1
	Dim arrPT2
	
	Dim strPT1
	Dim strPT2
	
	arrPT1 = Rhino.GetPoint("Pick first point")
	
	arrPT2 = Rhino.GetPoint("Pick second point", arrPT1)
	
	strPT1 = ("(" & arrPt1(0) & "," & arrPt1(1) & "," & arrPt1(2) & ")")
	
	strPT2 = ("(" & arrPt2(0) & "," & arrPt2(1) & "," & arrPt2(2) & ")")
	
	Call Rhino.Print("Start Point = (" & strPT1 & ")")
	Call Rhino.Print("End Point = (" & strPT2 & ")")
	
	Rhino.Command "_-dimRotated"
	Rhino.Command strPT1
	Rhino.Command strPT2
	Rhino.Command strPT1
	Rhino.Command strPT2

End Sub

create the command:
strComand = "_-dimRotated" & " " & strPt1 & " " & strPt2 & " " & strPt1 & " " & strPt2

call it once

Call Rhino.Command(strCommand)

make sure you understood how to create a macro
https://wiki.mcneel.com/rhino/basicmacros

transforming double to string might be depend on the language settings of your pc. “culture specific” but i am not sure about this.

edit:
just checked the api
you should use

→ AddAlignedDimension
https://developer.rhino3d.com/api/rhinoscript/dimension_methods/addaligneddimension.htm

the api provides a simple sample

It works! Thanks Tom!

You are correct in that the “add” method is much better than fighting with the command line command line. But I couldn’t find the addRotatedDimension (or AddDimRotated) - but after looking just now I think it might be the addLinearDimension method.
There is a subtle different between the “aligned” and “rotated” dimensions that you may or may not already know about depending if you use either of them.

I don’t need to go very far into Rhino Script to get what I need from it, hence why I’m trying to jerry-rig something, just get it working really… before I go onto bigger stuff. I’m going to take the C# approach as I’ve found that I can use the macro for just about everything I’ll need until my C# skills allow me to do more complex stuff. I jumped head-first into the Rhino script because it is so similar to VBA; similar but different though.

Here’s the finished code which should work, but… as Tom mentioned, there could be regional string conversion issues:

Option Explicit

Call Main()

Sub Main()
	
	Dim arrPT1
	Dim arrPT2
	
	Dim strPT1
	Dim strPT2
	
	Dim strCommand
	
	arrPT1 = Rhino.GetPoint("Pick first point")
	
	arrPT2 = Rhino.GetPoint("Pick second point", arrPT1)
	
	strPT1 = (arrPt1(0) & "," & arrPt1(1) & "," & arrPt1(2))
	
	strPT2 = (arrPt2(0) & "," & arrPt2(1) & "," & arrPt2(2))
	
	Call Rhino.Print("Start Point = (" & strPT1 & ")")
	Call Rhino.Print("End Point = (" & strPT2 & ")")
	
	strCommand = "_dimRotated" & " " & strPT1 & " " & strPT2 & " " & strPT1 & " " & strPT2	
	
	Call Rhino.Command(strCommand)		

End Sub