Edit Vertical profile exaggerated scale using lisp

Edit Vertical profile exaggerated scale using lisp

Paul.GrafPZAZ7
Advocate Advocate
272 Views
4 Replies
Message 1 of 5

Edit Vertical profile exaggerated scale using lisp

Paul.GrafPZAZ7
Advocate
Advocate

I have a 100+ drawing that I need to edit the Profile View styles vertical scale to 4.0. My plan is to run a script on all these drawings using this script file. Here is the program I have so far. It gets hung up the line: (setq style (vla-get-Style obj))

 

My lisp skills for Civil 3d are not the best.

 

(defun c:VERT_SCALE_4 (/ ss i ent obj style)
(vl-load-com)
;; Search the entire drawing for Profile View objects
(setq ss (ssget "_X" '((0 . "AECC_PROFILE_VIEW"))))

(if ss
(progn
(setq i 0)
(repeat (sslength ss)
(setq ent (ssname ss i))
(setq obj (vlax-ename->vla-object ent))

;; Access the style and its graph settings
(setq style (vla-get-Style obj))

(vlax-put-property (vla-get-Graphstyle style) 'VerticalExaggeration 4.0)

(vla-update obj)
(setq i (1+ i))
)
(princ (strcat "\nUpdated " (itoa i) " Profile View(s)."))
)
(princ "\nNo Profile Views found in drawing.")
)
(princ)
)

 

paul

c3d 2024

 

 

 

0 Likes
Accepted solutions (2)
273 Views
4 Replies
Replies (4)
Message 2 of 5

hippe013
Advisor
Advisor
Accepted solution

For each profileView you would be setting the profileView's style to have a vertical exaggeration of 4.0, regardless of the style that is assigned to the profile view. That means that you could be setting the same vertical exaggeration on the same style, over and over again. I don't know why you would do it that way. Typically, several different profile view styles are defined at varying vertical exaggerations within a drawing. If it were me, I would have my code define a desired style, and then just set that style to all of the different profile views. That's just my two cents.

 

But on to getting the style and modifying the exaggeration.

;Given some profile view (pv)
(setq pv (vlax-ename->vla-object (car (entsel "\nSelect ProfileView: "))))

;Get the ProfileView Style
(setq pvStyle (vlax-get-property pv 'Style))

;Get the GraphStyle from the ProfileView Style
(setq graphStyle (vlax-get-property pvStyle 'GraphStyle))

;Set the Vertical Exaggeration
(vlax-put-property graphStyle 'VerticalExaggeration 4.0)

 

0 Likes
Message 3 of 5

Paul.GrafPZAZ7
Advocate
Advocate

I just have one profile in each drawing that was created with the Plan Production tools. I have a 3rd party program that will run a script file (.scr) on all the drawings in a folder. I am just trying to get a lisp routine to run using a script file, without having to manually select the profile. Right now, my profiles vertical exaggeration is set to 5 and I want to change it to 4. 

0 Likes
Message 4 of 5

Jeff_M
Consultant
Consultant
Accepted solution

@Paul.GrafPZAZ7 look at what @hippe013 posted and compare it to what you had tried. He gave you exactly what you need to use. Hint: Instead of vla-get- a property, use vlax-get-property obj 'theproperty

Jeff_M, also a frequent Swamper
EESignature
Message 5 of 5

Paul.GrafPZAZ7
Advocate
Advocate

Thank you very much. You both help me get this done. 

0 Likes