AutoCAD Civil 3D Customization

AutoCAD Civil 3D Customization

Reply
Contributor
tsimaros
Posts: 11
Registered: ‎03-30-2008
Message 1 of 2 (195 Views)

VBA PROBLEM

195 Views, 1 Replies
06-18-2012 12:56 AM

i am trying to translate a Point coordinates from Paperspce to world coordinates in model space.The code i used in Land2006 worked OK but now in Civil3d 2012 it doesn't!

 

Private Sub GetPlais_Click()
Dim tmpnt1 As Variant, tmpnt2 As Variant, tmpPnt1 As Variant
Dim lole(0 To 2) As Double, upri(0 To 2) As Double
Dim returnobj As AcadObject

FrmGrid3.Hide
On Error GoTo Eline
ThisDrawing.Utility.GetEntity returnobj, tmpPnt1, "ÅðÝëåîå ôï ViewPort ðïõ èá äçìéïõñãçèåß ï êÜíáâïò!"
If TypeOf returnobj Is IAcadPViewport Then
Set viewportObj = returnobj
viewportObj.UCSIconOn = True
viewportObj.UCSIconAtOrigin = True
viewportObj.Display True
Scal = 1000 / viewportObj.CustomScale '= 1000 / CDbl(cbScale.Text)

Else
MsgBox "ÄÝí åðÝëåîåò ViewPort!!!", vbOKOnly, "Ó÷åäßáóç êáíÜâïõ"
FrmGrid3.Show
Exit Sub
End If
lole(0) = viewportObj.Center(0) - viewportObj.Width / 2
lole(1) = viewportObj.Center(1) - viewportObj.Height / 2
upri(0) = viewportObj.Center(0) + viewportObj.Width / 2
upri(1) = viewportObj.Center(1) + viewportObj.Height / 2

PntUpLPap(0) = lole(0): PntDoLPap(0) = lole(0): PntUpRPap(0) = upri(0): PntDoRPap(0) = upri(0)
PntUpLPap(1) = upri(1): PntDoLPap(1) = lole(1): PntUpRPap(1) = upri(1): PntDoRPap(1) = lole(1)

tmpnt1 = ThisDrawing.Utility.TranslateCoordinates(lole, acPaperSpaceDCS, acDisplayDCS, False)
tmpnt1 = ThisDrawing.Utility.TranslateCoordinates(tmpnt1, acDisplayDCS, acWorld, False)
TxtDoLX.Text = Format(tmpnt1(0), "0.##0"): PntDoLmod(0) = tmpnt1(0)
TxtDoLY.Text = Format(tmpnt1(1), "0.##0"): PntDoLmod(1) = tmpnt1(1)

tmpnt1 = ThisDrawing.Utility.TranslateCoordinates(upri, acPaperSpaceDCS, acDisplayDCS, False)
tmpnt1 = ThisDrawing.Utility.TranslateCoordinates(tmpnt1, acDisplayDCS, acWorld, False)
TxtUpRX.Text = Format(tmpnt1(0), "0.##0"): PntUpRmod(0) = tmpnt1(0)
TxtUpRY.Text = Format(tmpnt1(1), "0.##0"): PntUpRmod(1) = tmpnt1(1)

tmpnt1(0) = lole(0)
tmpnt1(1) = upri(1)
tmpnt1 = ThisDrawing.Utility.TranslateCoordinates(tmpnt1, acPaperSpaceDCS, acDisplayDCS, False)
tmpnt1 = ThisDrawing.Utility.TranslateCoordinates(tmpnt1, acDisplayDCS, acWorld, False)
TxtUpLX.Text = Format(tmpnt1(0), "0.##0"): PntUpLmod(0) = tmpnt1(0)
TxtUpLY.Text = Format(tmpnt1(1), "0.##0"): PntUpLmod(1) = tmpnt1(1)

tmpnt1(0) = upri(0)
tmpnt1(1) = lole(1)
tmpnt1 = ThisDrawing.Utility.TranslateCoordinates(tmpnt1, acPaperSpaceDCS, acDisplayDCS, False)
tmpnt1 = ThisDrawing.Utility.TranslateCoordinates(tmpnt1, acDisplayDCS, acWorld, False)
TxtDoRX.Text = Format(tmpnt1(0), "0.##0"): PntDoRmod(1) = tmpnt1(0)
TxtDoRY.Text = Format(tmpnt1(1), "0.##0"): PntDoRmod(1) = tmpnt1(1)

Eline:
FrmGrid3.Show
End Sub

I can't understand the problem!!!!

*Expert Elite*
Alfred.NESWADBA
Posts: 9,099
Registered: ‎06-29-2007
Message 2 of 2 (170 Views)

Re: VBA PROBLEM

06-21-2012 12:24 PM in reply to: tsimaros

>>>cross-posting<<<

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.