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: 

SCALE COGO POINTS X & Y RETAIN Z

1 REPLY 1
Reply
Message 1 of 2
allanbsteven
450 Views, 1 Reply

SCALE COGO POINTS X & Y RETAIN Z

Hi There,

Below is code to scale X,Y and NOT Z of a cogo point, I am wondering how I can incorporate all polylines and lines as well.

Any help is appreciated.

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"
			      )
			      ;;2015
			      (t "")
			 )
		 )
  )

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

)

 

1 REPLY 1
Message 2 of 2

You would want to copy and modify this block of code twice, once for polylines and once for lines:

    (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

You'll want to save the elevation value of the polyline and then assign it to the polyline once scaled. You will also want to store the elevation of the line points and then assign them after scaling. 

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report