Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can this really be that easy? AeccXUILand point object call Visual Lisp

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
429 Views, 4 Replies

Can this really be that easy? AeccXUILand point object call Visual Lisp

After dinking around the forums for a bit, I worked out this snippet for
dealing with single point objects... While it was worth it to see the
'SelectPoints method for getting and using a selection set of C3D points,
this works better for my particular application. It appears I don't need
to go through the gyrations of setting the vlax-get-acad-object and
vla-getinterfaceobject *acad* AeccXUiLand.AeccApplication.5.0 calls to edit
single points. If I need to get to the points collection, now there is a
different story....

Mark Evinger

=====================
(setq CGL_ENT (entsel "\nPlease select point object to modify: "))
(setq CGL_OBJECT (entget (car CGL_ENT)))
(cond
((= (cdr (assoc 0 CGL_OBJECT)) "AECC_COGO_POINT") ;c3d point
(princ "\nThis is a C3D Point.")
(princ)
(vl-load-com)


(setq PntObj (vlax-ename->vla-object (cdr (assoc -1 CGL_OBJECT)))) ;<--
one line of code to deal with one point object?!?!


(setq PntObjNUM (vlax-get PntObj 'Number))
(setq PntObjELEV (vlax-get PntObj 'Elevation))
(setq PntObjRAWDESC (vlax-get PntObj 'RawDescription))
(setq PntObjFULLDESC (vlax-get PntObj 'FullDescription))
(setq PntObjLAYER (vlax-get PntObj 'Layer))
(princ (strcat "\nElevation of Pt#" (itoa PntObjNUM) " = " (rtos
PntObjELEV 2 4)))
(princ (strcat "\nRaw Description of Pt#" (itoa PntObjNUM) " = "
PntObjRAWDESC))
(princ (strcat "\nFull Description of Pt#" (itoa PntObjNUM) " = "
PntObjFULLDESC))
(princ (strcat "\nPointLayer of PT#" (itoa PntObjNUM) " = "
PntObjLAYER))
;... string manipulation routines here for changing layer and
RawDescription
(vlax-put PntObj 'Rawdescription RawDescNew) ;change the RawDescription
(vlax-put PntObj 'Layer CGL_OBJ_FRZ) ;put the object on a frozen layer
(princ)
) ;aecc_points

((= (cdr (assoc 0 CGL_OBJECT)) "AECC_POINT") ; LDT point
(princ "\nThis is an LDT Point.")
(princ)
) ;LDT style points

((and (= (cdr (assoc 0 CGL_OBJect)) "INSERT")
(= "POINT" (cdr (assoc 2 CGL_OBJECT)))) ;SDSK point
(princ "\nThis is an SDSK Point block.")
(princ)
) ;SDSK point block

(T
(princ (strcat "\nThis is not a point object, it is a " (cdr (assoc 0
CGL_OBJECT))"."))) ;all other objects
) ;end cond

=====================
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: Anonymous

Mark,

It is that easy, but if you did it in VBA it would be even more straight
forward. The thing that I like about VBA is that you don't have to remember
the name of the function calls, VBA will show you a list of them, and I find
it much eaiser to read and maintain. In addition, most of the the help and
the samples for the Civil 3D are written in VBA.

Here is your code in VBA, the difference is that I'm not looking for the LDT
point object (but I could) and I'm displaying a dialog box with the point
infomration instead of putting it to the command line.

Option Explicit

Public Sub PointTest()
Dim obj As AcadObject
Dim pt As Variant
Dim sMsg As String
Dim cgPoint As AeccPoint
ThisDrawing.Utility.GetEntity obj, pt, "Select point:"
If TypeOf obj Is AeccPoint Then
Set cgPoint = obj
sMsg = "Elevation = " & Format(cgPoint.Elevation, "0.00")
sMsg = sMsg & vbCr & "Raw Description = " & cgPoint.RawDescription
sMsg = sMsg & vbCr & "Full Description = " & cgPoint.FullDescription
sMsg = sMsg & vbCr & "Layer = " & cgPoint.Layer
MsgBox sMsg, vbInformation, "Point #" & cgPoint.Number

cgPoint.RawDescription = "new raw"
cgPoint.Layer = "Layer1" 'change the layer of the point
End If
End Sub

Regards,

Peter Funk
Civil 3D Product Manager
Autodesk, Inc.
Message 3 of 5
Anonymous
in reply to: Anonymous

>> (setq PntObj (vlax-ename->vla-object
>> (cdr (assoc -1 CGL_OBJECT)))) ;<-- one line of code
>> to deal with one point object?!?!

Hi Mark. You don't really need that, because:

(cdr (assoc -1 (entget )))

always returns the same

So you could just pass the first element of the list
returned by (entsel) to (vlax-ename->vla-object),
and its the same.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

"Mark Evinger" wrote in message news:5698231@discussion.autodesk.com...
After dinking around the forums for a bit, I worked out this snippet for
dealing with single point objects... While it was worth it to see the
'SelectPoints method for getting and using a selection set of C3D points,
this works better for my particular application. It appears I don't need
to go through the gyrations of setting the vlax-get-acad-object and
vla-getinterfaceobject *acad* AeccXUiLand.AeccApplication.5.0 calls to edit
single points. If I need to get to the points collection, now there is a
different story....

Mark Evinger

=====================
(setq CGL_ENT (entsel "\nPlease select point object to modify: "))
(setq CGL_OBJECT (entget (car CGL_ENT)))
(cond
((= (cdr (assoc 0 CGL_OBJECT)) "AECC_COGO_POINT") ;c3d point
(princ "\nThis is a C3D Point.")
(princ)
(vl-load-com)


(setq PntObj (vlax-ename->vla-object (cdr (assoc -1 CGL_OBJECT)))) ;<--
one line of code to deal with one point object?!?!


(setq PntObjNUM (vlax-get PntObj 'Number))
(setq PntObjELEV (vlax-get PntObj 'Elevation))
(setq PntObjRAWDESC (vlax-get PntObj 'RawDescription))
(setq PntObjFULLDESC (vlax-get PntObj 'FullDescription))
(setq PntObjLAYER (vlax-get PntObj 'Layer))
(princ (strcat "\nElevation of Pt#" (itoa PntObjNUM) " = " (rtos
PntObjELEV 2 4)))
(princ (strcat "\nRaw Description of Pt#" (itoa PntObjNUM) " = "
PntObjRAWDESC))
(princ (strcat "\nFull Description of Pt#" (itoa PntObjNUM) " = "
PntObjFULLDESC))
(princ (strcat "\nPointLayer of PT#" (itoa PntObjNUM) " = "
PntObjLAYER))
;... string manipulation routines here for changing layer and
RawDescription
(vlax-put PntObj 'Rawdescription RawDescNew) ;change the RawDescription
(vlax-put PntObj 'Layer CGL_OBJ_FRZ) ;put the object on a frozen layer
(princ)
) ;aecc_points

((= (cdr (assoc 0 CGL_OBJECT)) "AECC_POINT") ; LDT point
(princ "\nThis is an LDT Point.")
(princ)
) ;LDT style points

((and (= (cdr (assoc 0 CGL_OBJect)) "INSERT")
(= "POINT" (cdr (assoc 2 CGL_OBJECT)))) ;SDSK point
(princ "\nThis is an SDSK Point block.")
(princ)
) ;SDSK point block

(T
(princ (strcat "\nThis is not a point object, it is a " (cdr (assoc 0
CGL_OBJECT))"."))) ;all other objects
) ;end cond

=====================
Message 4 of 5
allanbsteven
in reply to: Anonymous

Hi Peter,

How does one save this as a vba file? Also how do I load into Civil3d?

Thanks

Allan

Message 5 of 5
allanbsteven
in reply to: Anonymous

HI Mark,

I have just seen this post. Is it available in Civil3d 2014?

I can't get it to work, same with the vba? Any change you can post an update if there is one?

Thanks

Allan

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report