Jump to content

Connect Points AutoLISP


prowill

Recommended Posts

Recently upgraded to Civil 3D 2015 from 2013 but am having trouble using one of my most used AutoLISP commands to connect a string of points (connectpts)

 

When I load the command I get the following error message;

 

"; error: Automation Error. Problem in loading application"

 

Any ideas out there?

 

This is file;

 

;|Platform: AutoCAD Civil 3D

Routine to draw 3dPoly between points with identical descriptions, in ascending Pt# order.

by Jeff Mishler, July 25, 2007. Tested only in C3D2008. Type (vl-load-com) at command prompt first.

|;

(vl-load-com)

(defun c:Connectpts (/ appstr coords desc grps pline point point#s points pt qbldr ss tmpgrp vrsn )

(setq vrsn (vlax-product-key))

(cond ((vl-string-search "R16.2" vrsn)(setq appstr "3.0"));;2006

((vl-string-search "R17.0" vrsn)(setq appstr "4.0"));;2007

((vl-string-search "R17.1" vrsn)(setq appstr "5.0"));;2008

((vl-string-search "R17.2" vrsn)(setq appstr "6.0"));;2009

((vl-string-search "R18.0" vrsn)(setq appstr "7.0"));;2010

((vl-string-search "R18.1" vrsn)(setq appstr "8.0"));;2011

((vl-string-search "R18.2" vrsn)(setq appstr "9.0"));;2012

((vl-string-search "R19.0" vrsn)(setq appstr "10.0"));;2013

((vl-string-search "R19.1" vrsn)(setq appstr "11.0"));;2014

((vl-string-search "R20.0" vrsn)(setq appstr "12.0"));;2015

(t (alert "This version of C3D not supported!"))

)

(if (and appstr

(or *acad*

(setq *acad* (vlax-get-acad-object))

)

(or *AeccApp*

(setq *AeccApp* (vla-getinterfaceobject *acad*

(strcat "AeccXUiLand.AeccApplication." appstr)))

)

(or *AeccDoc*

(setq *AeccDoc* (vlax-get *AeccApp* 'ActiveDocument))

)

(setq ss (ssget ":S:E" '((0 . "AECC_COGO_POINT"))))

)

(progn

(setq pt (vlax-ename->vla-object (ssname ss 0))

desc (vlax-get pt 'RawDescription)

grps (vlax-get *AeccDoc* 'PointGroups)

tmpgrp (vlax-invoke grps 'Add "__TEMP__")

)

(setq qbldr (vlax-get tmpgrp 'querybuilder))

(vlax-put qbldr 'IncludeRawDescriptions desc)

(if (> (length (setq points (vlax-get tmpgrp 'Points))) 1)

(progn

(setq point#s (vl-sort points '

(setq points (vlax-get *AeccDoc* 'Points))

(foreach pt# point#s

(setq point (vlax-invoke points 'Find pt#))

(setq coords (append coords (list (vlax-get point 'Easting)

(vlax-get point 'Northing)

(vlax-get point 'Elevation)

)))

)

(setq pline (vlax-invoke (vla-get-modelspace *AeccDoc*) 'Add3dPoly coords))

(vla-put-layer pline (vlax-invoke *aeccdoc* 'getvariable "Clayer"))

)

)

(vlax-invoke qbldr 'clear)

(vlax-invoke grps 'remove "__TEMP__")

)

)

(princ)

)

Link to comment
Share on other sites

Pretty sure had same problem last week and I had to do a Repair on CIV3d, it does not find the AeccXuland version properly.

 

Just run the version part of your code as a check if it errors then Repair required.

 

(vl-load-com)
(setq vrsn (vlax-product-key))
((vl-string-search "R20.0" vrsn)(setq appstr "12.0"));;2015
(princ appstr) ; if not display then  problem

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...