I got another one for you within this. I was hoping to Select the Profile View to Grab the Alignment. However, with this setup, I have to pick the alignment first. Then it will select all the Civil3D PN parts and the PressureN Parts, and place them into the selected profile view. I was trying to use the original selection set and apply it to both these commands (AddNetworkPartsToProf, AddPressurePartsToProf). Not having much luck. Any ideas?
(defun c:PN2PV (/ add ss i e l d g lst s n alignEnt alignObj startSta endSta)
(setq add (ssadd))
(princ "\nSelect Alignment: ")
(if (setq ss (ssget '((0 . "AECC_ALIGNMENT"))))
(progn
;; If selection set is not empty
(repeat (setq i (sslength ss))
(setq e (ssname ss (setq i (1- i)))
l (vlax-curve-getdistatpoint e (vlax-curve-getendpoint e))
d (/ l 300.)
g d
lst nil)
(repeat 300
(setq lst (cons (vlax-curve-getpointatdist e g) lst)
g (+ g d)))
(setq lst (append lst (list (vlax-curve-getstartpoint e))))
(if (setq s (ssget "_F" lst '((0 . "AECC_STRUCTURE,AECC_PIPE,AECC_PRESSUREPIPE,AECC_FITTING,AECC_APPURTENANCE"))))
(repeat (setq n (sslength s))
(ssadd (ssname s (setq n (1- n))) add))))
(sssetfirst nil add)
(command "AddNetworkPartsToProf"))
(if (setq s (ssget "_F" lst '((0 . "AECC_STRUCTURE,AECC_PIPE,AECC_PRESSUREPIPE,AECC_FITTING,AECC_APPURTENANCE"))))
(repeat (setq n (sslength s))
(ssadd (ssname s (setq n (1- n))) add))))
(sssetfirst nil add)
(command "AddPressurePartsToProf"))
(princ "\nNo entities selected."))
(princ))