CAD Forums > Vertically Challenged
MatchProps Profile View (Station and Elevation)
(1/1)
MSTG007:
I was playing around with creating a routine that would allow you to change the profile view station and elevation rather than right clicking on the profile view and going through all the tabs.
I do have something together, however I am having a problem making the match properties of the command.
This will prompt the user to enter the values with a Start Station and End Station, with a Min Elevation and Max Elevation.
--- Code: ---(defun C:PRS ( / StaS StaE ElevMin ElevMax )
(vl-load-com)
;;https://forums.autodesk.com/t5/civil-3d-customization/define-profile-view-station-and-elevation-ranges-via-lisp/td-p/9683823
;Unlocks ProfileView station and elevation inputs
(setq pvent (car (entsel)))
(setq pv (vlax-ename->vla-object pvent))
(if (= 0 (vlax-get pv 'elevationlocked))
(vlax-put-property pv 'elevationlocked :vlax-false)
)
(if (= 0 (vlax-get pv 'stationlocked))
(vlax-put-property pv 'stationlocked :vlax-false)
)
;(vlax-put pv 'elevationmin 902)
;(vlax-put pv 'elevationmax 928)
;(vlax-put pv 'StationStart -10)
;(vlax-put pv 'StationEnd 30)
(setq StaS (getreal "Enter Start Station: "))
(setq StaE (getreal "Enter End Station: "))
(setq ElevMin (getreal "Enter Min Elevation: "))
(setq ElevMax (getreal "Enter Max Elevation: "))
(vlax-put pv 'StationStart StaS)
(vlax-put pv 'StationEnd StaE)
(vlax-put pv 'elevationmin ElevMin)
(vlax-put pv 'elevationmax ElevMax)
(princ)
)
--- End code ---
I am guessing i could use the
--- Code: ---;(vlax-get pv 'elevationmin )
;(vlax-get pv 'elevationmax )
;(vlax-get pv 'StationStart )
;(vlax-get pv 'StationEnd )
Then use it as a vlax-put
--- End code ---
Thanks for any pointers!
Jeff_M:
For a MatchProperties type I can't think of a time I'd want to set the start/end stations of PVs to match another PV. The Min/Max elevations, sure, so that is what the following does:
--- Code - Auto/Visual Lisp: ---(defun C:MatchPVElevations (/ ss sourcePV pv ElevMin ElevMax) (vl-load-com) (if (setq ss (ssget "_:S" '((0 . "AECC_PROFILE_VIEW")))) (progn (setq sourcePV (vlax-ename->vla-object (ssname ss 0)) minElev (vlax-get sourcePV 'elevationmin) maxElev (vlax-get sourcePV 'elevationmax) ) (while (setq ss (ssget "_:S" '((0 . "AECC_PROFILE_VIEW")))) ;;https://forums.autodesk.com/t5/civil-3d-customization/define-profile-view-station-and-elevation-ranges-via-lisp/td-p/9683823 ;Unlocks ProfileView station and elevation inputs (setq pv (vlax-ename->vla-object (ssname ss 0))) (if (= 0 (vlax-get pv 'elevationlocked)) (vlax-put-property pv 'elevationlocked :vlax-false) ) (vlax-put pv 'elevationmin minElev) (vlax-put pv 'elevationmax maxElev) ) ) ) (princ))
If you do want the stations to match as well, that would be simple enough to add in.
MSTG007:
Thanks Jeff. Opens up for some ideas and works great. Appreciate the help.
ribarm:
@Jeff
Small remark :
(while (setq ss (ssget "_:S" '((0 . "AECC_PROFILE_VIEW"))))
should be :
(while (setq ss (ssget "_:S:L" '((0 . "AECC_PROFILE_VIEW"))))
Jeff_M:
@ribarm, thanks! And after further review both ssget calls really should've been this: ssget "_:S+.:L" (the :L not required for the first one)
Navigation
[0] Message Index
Go to full version