Hi,
I think you would need to be a bit more specific. 🙂 What exactly would you like to do?
Are you trying to run a command from VBA?
For that you can use SendCommand() - e.g. SendCommand("_LINE 0,0,0 10,10,0 ")
I hope this helps.
Cheers,
Adam Nagy
Autodesk Developer Network
For example, I want to run in the macro Area command.
1)When I run the macro, asks area of corner points
2) when I choose the points , asks to write where the measured field
3) when I choose the points where write the area, value of area is written there.
I hope, I can describe.
Not sure what you mean about command in macro,
here is just very basic example:
{code}
Option Explicit
Sub TestArea()
' Define points
Dim Pnt1, Pnt2, Ptxt
' Return a point using a prompt
Pnt1 = ThisDrawing.Utility.GetPoint(, "Specify first corner point: ")
' Prompt the user to pick second point and returns the point
Pnt2 = ThisDrawing.Utility.GetCorner(Pnt1, "Specify other corner point: ")
' Prompt the user to pick text point and returns the point
Ptxt = ThisDrawing.Utility.GetPoint(, "Specify middle point of text: ")
' Get width and height of specified rectangle
Dim dblWidth As Double
dblWidth = Abs(CDbl(Pnt1(0)) - CDbl(Pnt2(0)))
Dim dblHeight As Double
dblHeight = Abs(CDbl(Pnt1(1)) - CDbl(Pnt2(1)))
' Calculate an area
Dim dblArea As Double
dblArea = dblWidth * dblHeight
Dim intPrec As Integer
' Prompt the user to specify precision and return number of decimal places
intPrec = CInt(InputBox("Enter a number of decimals:", "Area Label", 3))
Dim strArea As String
' Convert a real value of 'dblArea' using Decimal mode to a String
strArea = ThisDrawing.Utility.RealToString(dblArea, acDecimal, intPrec)
Dim txtHeight As Double
' Get the currrent dimension style text height
txtHeight = ThisDrawing.GetVariable("Dimtxt")
' Create the text object in the current space
Dim oText As AcadText
Set oText = ThisDrawing.ActiveLayout.Block.AddText(strArea, Ptxt, txtHeight)
' Change the value of the HorizontalAlignment and
' TextAlignmentPoint properties.
oText.HorizontalAlignment = acHorizontalAlignmentCenter
oText.Alignment = acAlignmentMiddleCenter
oText.TextAlignmentPoint = Ptxt
End Sub
{code}
~'J'~