I am converting from Acad to IJCAD.
Click point coordinates with GetEntity in the code below
I got it and handed it over to GetPoint, but I can't get a rubber band.Is there another way?
DimptPick As Object=Nothing'ptPick is the pick position
ptPick=Nothing
On Error Resume Next'GetEntity and let Err slide
US>'----------------------------------------------------------------------------
DOC.Utility.GetEntity (Myobj,ptPick,vbCrLf&txt)
'------------------
If Err. Number < > 0 Then GoTo UU'Pick Missing
x1 = ptPick(0)
y1 = ptPick(1)
ChkPrint("click point=("&Format(x1, "0.00")&", "&_
Format(y1, "0.00")&") Click "&_
Myobj.objectName&"Lay="&Myobj.Layer)
--------------------------------------------------------------------------------------------------------------------------------------------------
ptPick=DOC.Utility.GetPoint(ptPick,_
US>"Click on the drawing position:")
'------------------
If Err. Number <>0 Then GoTo UU
x2 = ptPick(0)
y2 = ptPick(1)
I rewritten the source code below and tried running it
DimptPick(0 To 2) As Double
On Error Resume Next'GetEntity and let Err slide
US>'----------------------------------------------------------------------------
DOC.Utility.GetEntity (Myobj,ptPick,vbCrLf&txt)
'------------------
If Err. Number < > 0 Then GoTo UU'Pick Missing
x1 = ptPick(0)
y1 = ptPick(1)
DimptPick2(0 To 2) As Double
On Error Resume Next
--------------------------------------------------------------------------------------------------------------------------------------------------
ptPick2 = DOC.Utility.GetPoint(ptPick, vbCrLf&_
US>"Click on the drawing position:")
'------------------
If Err. Number <>0 Then GoTo UU
x2 = ptPick2(0)
y2 = ptPick2(1)
Doesn't the rubber band come out? (The coordinates have been obtained successfully)
I will try the following from now on
(1) Try copying and executing the reference code as it is
(2) Check the IJCAD configuration as it may be an environmental problem
DimptPick As Object=Nothing'ptPick is the pick position
DimptPick As Variant'ptPick is in the pick position
Try changing to .
Note ①
For VB.NET 2008,
DimptPick(0 To 2) As Double
Try changing to .
Additional note <
When I created a sample code to select an entity, enter coordinates, and move an entity, I ran it on IJCAD and found that the rubber band was displayed without any problems.
The sample code is as follows:
Dim app As GcadApplication=New GcadApplication
app.Visible=True
If app.Documents.Count = 0 Then
app.Quit()
Exit Sub
End If
Dim doc As GcadDocument=app.ActiveDocument
Dimcenter(0 To 2) As Double
center(0) = 50
center(1) = 50
center(2) = 0
doc.ModelSpace.AddCircle(center, 50.0)
Dimobj As GcadEntity = Nothing
DimpickPt1(0 To 2) As Double
doc.Utility.GetEntity(obj,pickPt1,vbCrLf+"Select entity")
If Err. Number <>0 Then GoTo EndLabel
DimpickPt2(0 To 2) As Double
pickPt2=doc.Utility.GetPoint(pickPt1,vbCrLf+"Input point")
If Err. Number <>0 Then GoTo EndLabel
obj.Move (pickPt1, pickPt2)
EndLabel:
app.Quit()
© 2024 OneMinuteCode. All rights reserved.