### Author Topic: StartPoint and endpoint of a AcadDimRotated  (Read 3410 times)

0 Members and 1 Guest are viewing this topic.

#### Humbertogo

• Guest
##### StartPoint and endpoint of a AcadDimRotated
« on: May 29, 2007, 09:24:31 AM »
How to get the StartPoint and endpoint of a  AcadDimRotated
and how to explode a AcadDimension

#### Bryco

• Water Moccasin
• Posts: 1883
##### Re: StartPoint and endpoint of a AcadDimRotated
« Reply #1 on: May 29, 2007, 10:47:32 AM »
Basically by using lisp dxf codes 13,14
varTest = vbAssoc(objDim, 13)
StartPt = ParseDxfPoint(varTest)

varTest = vbAssoc(objDim, 14)
EndPt = ParseDxfPoint(varTest)

Code: [Select]
`Function ParseDxfPoint(DxfPoint)    Dim Pt(2) As Double    Dim Gap1, Gap2    Gap1 = InStr(2, DxfPoint, " ", vbTextCompare)    Pt(0) = Mid(DxfPoint, 2, Gap1 - 1)    Gap2 = InStr(Gap1 + 1, DxfPoint, " ", vbTextCompare)    Pt(1) = Mid(DxfPoint, Gap1 + 1, Gap2 - (Gap1 + 1))    Pt(2) = Mid(DxfPoint, Gap2 + 1, Len(DxfPoint) - (Gap2 + 1))    ParseDxfPoint = Pt    End Function'SomeCallMeDave'http://www.vbdesign.net/expresso/showthread.php?postid=83887#post83887'Changed pAcadObj As AcadObject to pAcadObj As Object to access imagedef as well'Modified by Jeff Mishler, March 2006, to get the Block table object, not Block_Record table objectPublic Function vbAssoc2(pAcadObj, pDXFCode As Integer) As VariantDim VLisp As ObjectDim VLispFunc As ObjectDim varRetVal As VariantDim obj1 As ObjectDim obj2 As ObjectDim strHnd As StringDim strVer As StringDim lngCount As LongDim i As LongDim J As LongOn Error GoTo vbAssocError    If Left(ThisDrawing.Application.Version, 2) = "16" Then  Set VLisp = ThisDrawing.Application.GetInterfaceObject("VL.Application.16")Else  Set VLisp = ThisDrawing.Application.GetInterfaceObject("VL.Application.1")End IfSet VLispFunc = VLisp.ActiveDocument.FunctionsstrHnd = pAcadObj.HandleIf TypeOf pAcadObj Is AcadBlock Then    strHnd = Hex(1 + Val("&H" & strHnd))End IfSet obj1 = VLispFunc.Item("read").Funcall("pDXF")  varRetVal = VLispFunc.Item("set").Funcall(obj1, pDXFCode)Set obj1 = VLispFunc.Item("read").Funcall("pHandle")  varRetVal = VLispFunc.Item("set").Funcall(obj1, strHnd)Set obj1 = VLispFunc.Item("read").Funcall("(vl-princ-to-string (cdr (assoc pDXF (entget (handent pHandle)))))")  varRetVal = VLispFunc.Item("eval").Funcall(obj1)vbAssoc2 = varRetVal'clean up the newly created LISP symbolsSet obj1 = VLispFunc.Item("read").Funcall("(setq pDXF nil)")  varRetVal = VLispFunc.Item("eval").Funcall(obj1)Set obj1 = VLispFunc.Item("read").Funcall("(setq pHandle nil)")  varRetVal = VLispFunc.Item("eval").Funcall(obj1)'release the objects or Autocad gets squirrely (no offense RR)Set obj2 = NothingSet obj1 = NothingSet VLispFunc = NothingSet VLisp = NothingExit Function`

#### Humbertogo

• Guest
##### Re: StartPoint and endpoint of a AcadDimRotated
« Reply #2 on: May 29, 2007, 10:50:34 AM »
Thanks