Civil Points entities in lisp

Hello

A want to create a lisp that uses Civil Points as input (the user selects some civil points and then some things will drawn).

I firstly want to access the civil points using lisp so to get their Easting, Northing, Elevation and Raw Description. Any help to this direction would be welcomed.

Comments

  • Do you mean to string the points using a pt description ? I have started to do something.

    Some sample data code. The string 01F will be joined to all 01F's and so on.

    1

    921.889

    4915.96

    48.25

    01F

    2

    967.024

    4921.68

    49.39

    01F

    3

    1045.51

    4921.584

    52.09

    01F

    4

    1126.961

    4941.48

    54.36

    01F

    5

    1123.036

    5051.04

    56.34

    01F

    6

    976.679

    5005.819

    50.53

    TR

    7

    1047.843

    5074.345

    56.26

    01BB

    8

    1000.876

    5079.2

    54.62

    01F

    9

    896.378

    5054.56

    51.03

    01F

    10

    892.944

    4978.88

    48.94

    01F

    11

    913.884

    4913.589

    48.12

    01EB

    12

    991.606

    4917.719

    50.21

    01ET

    13

    997.129

    4919.734

    50.32

    05F

    14

    985.194

    4955.816

    49.03

    01ET

    15

    969.494

    4984.416

    49.42

    01ET

  • George1
    edited July 23

    No I don't mean that.

    I mean every entity (line, text etc) has properties (for a line these properties are layer, linewidth, start coordinates, etc) that can be retrieved through auto lisp. I want to retrieve the properties of Civil Points, that can be Easting, Northing, etc.

  • use getpropertyvalue

    (getpropertyvalue (car(entsel)) "Easting")

  • As a side note, I recently added a KD-Tree in Python to aid in working with generic 3d points, but you should be able to use civil points to, since the tree returns the index

    import traceback
    from pyrx import Ap, Ax, Db, Ed, Ge, Gi, Rx, Cv
    
    
    @Ap.Command()
    def doit() -> None:
        try:
    
            filter = [(Db.DxfCode.kDxfStart, "BSYSCVDBPOINT")]
            ps, ss = Ed.Editor.select(filter)
            if ps != Ed.PromptStatus.eOk:
                raise RuntimeError("Selection Error! {}: ".format(ps))
    
            #get the cv points and ge points, 
            cvpnts = [Cv.CvDbPoint(id) for id in ss.objectIdArray()]
            gepnts = [cvpnt.position() for cvpnt in cvpnts]
    
            # is a nanoflann tree
            tree = Ge.Point3dTree(gepnts)
            
            #search 
            idxs, dists = tree.knnSearch(gepnts[0], 2)
            for ind in idxs:
                if ind == 0:
                    continue
                print(
                    cvpnts[0].easting(),
                    cvpnts[0].northing(),
                    cvpnts[0].elevation(),
                    cvpnts[0].fullDescription(),
                )
                print(
                    cvpnts[ind].easting(),
                    cvpnts[ind].northing(),
                    cvpnts[ind].elevation(),
                    cvpnts[ind].fullDescription(),
                )
                Ed.Core.grDraw(gepnts[0],gepnts[ind],1,0)
        except Exception as err:
            traceback.print_exception(err)
    
    

  • Thanks. It works.

    Do you know the property name of Point row description? I have tried Pointrawdescription and several other similar names but they don't exist.

  • I think there’s a function that will give all the possible properties for an entity

    https://developer.bricsys.com/bricscad/help/en_US/V23/DevRef/index.html?page=source%2FgetPropertyValue.htm

  • Yes it's dumpAllProperties. Thanks again!

  • Also use dumpit.lsp then say (vlax-get obj 'property) it will become one of those must have lisp.

    ;;;===================================================================;
    ;;; DumpIt ;
    ;;;-------------------------------------------------------------------;
    ;;; Dump all methods and properties for selected objects ;
    ;;;===================================================================;
    (defun C:Dumpit ( / ent)
    (while (setq ent (entsel "\n pick object "))
    (vlax-Dump-Object
    (vlax-Ename->Vla-Object (car ent))
    )
    )
    (princ)
    )

    ;(dumpallproperties (car (entsel)))

  • Jason Bourhill
    edited July 24

    This function will print the properties of selected civil points out to the screen

    (defun C:CivilPointInfo ( / sset ptEname)
    (cond
    ((vl-load-civil) ; Load the Civil API. requires BricsCAD Pro or greater
    (princ "\nSelect Civil points to get info on: ")
    (setq sset (ssget '((0 . "BsysCvDbPoint")(410 . "Model")))) ; allow selection of only Civil points
    (cond
    (sset
    (foreach ptEname (vle-selectionset->list sset) ; foreach civil point
    (princ "\n---------------------------------------")
    (princ "\nCivil Point Number: ")(princ (civil:point-get-number ptEname))
    (princ "\n---------------------------------------")
    (princ "\nName: ") (princ (civil:point-get-name ptEname))
    (princ "\nRaw Description: ")(princ (civil:point-get-rawdesc ptEname))
    (princ "\nFull Description: ")(princ (civil:point-get-fulldesc ptEname))
    (princ "\nDescription: ")(princ (civil:point-get-description ptEname))
    (princ "\nPosition: ")(princ (civil:point-get-position ptEname))
    (princ "\nEasting: ")(princ (civil:point-get-easting ptEname))
    (princ "\nNorthing: ")(princ (civil:point-get-northing ptEname))
    (princ "\nElevation: ")(princ (civil:point-get-elevation ptEname))
    (princ "\n---------------------------------------")
    (princ "\n")
    )
    )
    (T (princ "\nNo Civil points selected"))
    )
    )
    (T (princ "\nSorry you need BricsCAD Pro or greater to work with Civil Points"))
    )
    (prin1)
    )

    Jason Bourhill

    CAD Concepts Ltd

    cadconcepts.co.nz