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: 

modify a lisp file to work in civil 3d 2015

20 REPLIES 20
SOLVED
Reply
Message 1 of 21
htls69
2814 Views, 20 Replies

modify a lisp file to work in civil 3d 2015

the attached file work perfectly in civil 3d 2012 but in civil 3d 2015 it does not work at all

 

i was wondering if someone on here could modify it to work in civil 3d 2015 

 

thanks in advance 

 

Allen

Allen Robberson
Credit where credit is due! Give kudos or accept as solution whenever you can.
20 REPLIES 20
Message 2 of 21
Jeff_M
in reply to: htls69

Attached is updated for C3D2015 lisp. 

Jeff_M, also a frequent Swamper
EESignature
Message 3 of 21
htls69
in reply to: Jeff_M

awesome thanks a lot
Allen Robberson
Credit where credit is due! Give kudos or accept as solution whenever you can.
Message 4 of 21
htls69
in reply to: htls69

lisp is inverse by points so you can inverse between 2 point numbers and get bearing and distance
Allen Robberson
Credit where credit is due! Give kudos or accept as solution whenever you can.
Message 5 of 21
tyronebk
in reply to: htls69

Unless I am really overlooking something, there is no reason for this LSP to be version dependent. The properties for the selected cogo points can be called with vlax-get without fetching the Civil 3D document.

 

I rewrote it to remove the version dependence, plus a bit of other clean up and error checking. Attached.

Message 6 of 21
Jeff_M
in reply to: tyronebk


@tyronebk wrote:

Unless I am really overlooking something, there is no reason for this LSP to be version dependent. The properties for the selected cogo points can be called with vlax-get without fetching the Civil 3D document.

 

I rewrote it to remove the version dependence, plus a bit of other clean up and error checking. Attached.


Nope, you're right. I didn't even really look at the lisp, other than to see what the version was, change it, and comment out the call to the geomcal.arx. I saw it could be cleaned up quite a bit, but had no time to do so myself. Thanks for doing so!

Jeff_M, also a frequent Swamper
EESignature
Message 7 of 21
htls69
in reply to: tyronebk

AWESOME THANKS A LOT 

 

Allen Robberson
Credit where credit is due! Give kudos or accept as solution whenever you can.
Message 8 of 21
peterfunkautodesk
in reply to: htls69

I got back to what Jason said: Use the Inquiry Tool. It is a floating tool that you can keep open (rolled up if you want) and use it to make the point inverses. It give more information and remembers the points so that you may only need to pick one point.

 

Regards,

 

Peter Funk

Autodesk, Inc.



Peter Funk
Autodesk, Inc.

Message 9 of 21

The inquiry tools are useful and powerful, but not necessarily a replacement for a simple script like this. Their biggest drawback is the amount of time required to get to the information you are after. Allen's routine takes maybe two seconds to get a result (si, enter, pick pick), whereas the inquiry palette can take more than 10 seconds [analyze tab, inquiry tools, switch combobox to point inverse, click point 1, pick, click pt 2, pick]. If you are doing many points in a row though, the inquiry tools may make more sense.

 

I've personally written inquiry commands that I know already exist in the inquiry tools simply because the inquiry tools take too long to use. If there were commandline versions of these commands they would be much handier. Even aliases to bring up the different inquiry types would be helpful.

 

There are other things that slow me down when using the inquiry tools too, but are less of a concern. E.g. having to pick the profile or section view you want to work in when it is trivial to figure this out for the user; if there is any confusion about which view is being worked in, then prompt the user.

Message 10 of 21

I was suggesting that you don't close it so that you have a floating Inquiry Tool up all the time. I do have multiple monitors so I park it, but you could also use the "Auto-hide" or roll-up feature on the tool. It will stay on Point Inverse until you close Civil 3D, and the next time you'll only need to change the type. With the dialog floating you just pick the two points and get the inverse.

 

I understand the value of the quick LISP command. If you can remember command it is a great solution.

 

Peter Funk

Autodesk, Inc.



Peter Funk
Autodesk, Inc.

Message 11 of 21
htls69
in reply to: tyronebk

i was wondering if you could help me with another lisp reoutine to work in 2015 civil 3d

 

it is attached

 

 

Allen Robberson
Credit where credit is due! Give kudos or accept as solution whenever you can.
Message 12 of 21
Jeff_M
in reply to: htls69

Change the 9.0 in the following line to 10.4
(setq C3D (vla-getinterfaceobject *acad* "AeccXUiLand.AeccApplication.9.0"))

I did no other checking of this lisp, but should work.
Jeff_M, also a frequent Swamper
EESignature
Message 13 of 21
htls69
in reply to: Jeff_M

is there a way to not make it version dependant
Allen Robberson
Credit where credit is due! Give kudos or accept as solution whenever you can.
Message 14 of 21
Jeff_M
in reply to: htls69


@Anonymous wrote:
is there a way to not make it version dependant

Yes, I leave it to you to figure out how to implement this, that way you can update it yourself in the future.

  (vl-load-com)
  (setq prod (vlax-product-key))
  (setq	prodStr	(strcat	"AeccXUiLand.AeccApplication"
			(cond ((vl-string-search "\\R17.0\\" prod)
			       ".4.0"
			      )
			      ;;2007
			      ((vl-string-search "\\R17.1\\" prod)
			       ".5.0"
			      )
			      ;;2008
			      ((vl-string-search "\\R17.2\\" prod)
			       ".6.0"
			      )
			      ;;2009
			      ((vl-string-search "\\R18.0\\" prod)
			       ".7.0"
			      )
			      ;;2010
			      ((vl-string-search "\\R18.1\\" prod)
			       ".8.0"
			      )
			      ;;2011
			      ((vl-string-search "\\R18.2\\" prod)
			       ".9.0"
			      )
			      ;;2012
			      ((vl-string-search "\\R19.0\\" prod)
			       ".10.0"
			      )
			      ;;2013
			      ((vl-string-search "\\R19.1\\" prod)
			       ".10.3"
			      )
			      ;;2014
			      ((vl-string-search "\\R20.0\\" prod)
			       ".10.4"
			      )
			      ;;2015
			      (t "")
			)
		)
  )
  
  (if (and (setq *acad* (vlax-get-acad-object))
	   (setq doc (vla-get-activedocument *acad*))
	   (setq C3D (vla-getinterfaceobject *acad* prodStr))
	   (setq C3Ddoc (vla-get-activedocument C3D))	   
      )

 

Jeff_M, also a frequent Swamper
EESignature
Message 15 of 21
tyronebk
in reply to: htls69

There is no guarantee that this will work for all past or all future versions of Civil 3D, but it works for all the versions of C3D I have available for testing (2011 -> 2015).

 

Replace the line:

(setq C3D (vla-getinterfaceobject *acad* "AeccXUiLand.AeccApplication.9.0"))

 

With:

(setq C3D (strcat "HKEY_LOCAL_MACHINE\\" (if vlax-user-product-key (vlax-user-product-key) (vlax-product-key) ) )
    C3D (vl-registry-read C3D "Release")
    C3D (substr C3D 1 (vl-string-search "." C3D (+ (vl-string-search "." C3D) 1) ) )
    C3D (vla-getinterfaceobject *acad* (strcat "AeccXUiLand.AeccApplication." C3D) ) )

 

This should fill in the proper release number for the version of Civil 3D it is run in.

Message 16 of 21
htls69
in reply to: tyronebk

THAT WORK PERFECTLY THANKS
Allen Robberson
Credit where credit is due! Give kudos or accept as solution whenever you can.
Message 17 of 21
Jeff_M
in reply to: tyronebk

I learned something today! Thanks for that condensed code, @tyronebk
Jeff_M, also a frequent Swamper
EESignature
Message 18 of 21
allanbsteven
in reply to: tyronebk

Hi Tyronebk,

Not sure if you can help but i have now installed 2016 and saw your post about lisp dependant on what version of civil you are using. Any chance you can look at this one that scales but leaves the "z" value? Very handy in surveying .

No worries if not.

Thanks

Allan

 

(vl-load-com)

(defun c:go()
(getdoc)

  ;select points to scale
  (prompt "\nSelect points to scale: ")
  (setq ss (ssget))
  (setq len (sslength ss)
	ctr 0)

  ;get basepoint
  (setq p1 (getpoint "\nPick BasePoint: "))

  
  (setq sc (getreal "\nEnter Scale Factor: "))
  

  (while (< ctr len)
    (setq curpt (ssname ss ctr))
    (setq obtyp (cdr (assoc 0 (entget curpt))))
    (if (= obtyp "AECC_COGO_POINT")
      (progn
	(setq vpt (vlax-ename->vla-object curpt))
	(setq curz (vlax-get-property vpt 'Elevation))
	(vl-cmdf "Scale" curpt "" p1 sc)
	(vlax-put-property vpt 'Elevation curz)
	);end progn
      );end if
        
        (setq ctr (1+ ctr))
        
    );end while
  
  (vl-cmdf "REGEN")
(princ)


)	;end GO











(defun getdoc ()


  (setq prod (vlax-product-key))
  (setq	aecappno (strcat "AeccXUiLand.AeccApplication"
			 (cond ((vl-string-search "\\R17.0\\" prod)
				".4.0"
			        )
			      ;;2007
			      ((vl-string-search "\\R17.1\\" prod)
			       ".5.0"
			      )
			      ;;2008
			      ((vl-string-search "\\R17.2\\" prod)
			       ".6.0"
			      )
			      ;;2009
			      ((vl-string-search "\\R18.0\\" prod)
			       ".7.0"
			      )
			      ;;2010
			      ((vl-string-search "\\R18.1\\" prod)
			       ".8.0"
			      )
			      ;;2011
			      ((vl-string-search "\\R18.2\\" prod)
			       ".9.0"
			      )
			      ;;2012
			      ((vl-string-search "\\R19.0\\" prod)
			       ".10.0"
			      )
			      ;;2013
			      ((vl-string-search "\\R19.1\\" prod)
			       ".10.3"
			      )
			      ;;2014
			      ((vl-string-search "\\R20.0\\" prod)
			       ".10.4"
                              )
			      ;;2016
			      ((vl-string-search "\\R21.1\\" prod)
			       ".10.5"
			      )
			     
			 )
		 )
  )

  (setq	acadapp	(vlax-get-acad-object)
	c3dapp	(vla-getinterfaceobject acadapp aecappno)
	C3Ddoc	(vla-get-activedocument C3Dapp)
  )

)

 

Message 19 of 21
Jeff_M
in reply to: allanbsteven

Allan, there is no need to get the civil objects for this lisp. Just remove the (getdoc) line and all of the getdoc function code.

Jeff_M, also a frequent Swamper
EESignature
Message 20 of 21
allanbsteven
in reply to: Jeff_M

Awsome Jeff! Thanks.

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report