Jump to content

Selecting an Alignment from Profile View


rcb007

Recommended Posts

I stumbled upon this code at theswamp.org.  The user would pick a point on the profile view, then it would zoom to the alignment location and high light the alignment. 

 

Would there be any way to have it just select the alignment? I was playing around with possibly swapping the "      (vla-highlight align :vlax-true)" to be one for selecting it; but no luck.

 

(defun c:PV2AL (/ ss ent align profview endstation midstation pnt startstaion x y)
  ;;Profile view to zoom to alignment
  (command "undo" "begin")
  (vl-load-com)
  (setq ss (ssget ":S+." '((0 . "AECC_PROFILE_VIEW"))))
  (if ss
    (progn
      (setq ent (ssname ss 0))
      (setq pickpt  (last (last (car (ssnamex ss 0)))))
      (setq profview (vlax-ename->vla-object ent))
      (vlax-invoke-method profview 'findstationandelevationatxy (car pickpt)(cadr pickpt) 'sta 'elev)
      (setq startstation        (vlax-get profview 'stationstart)
            endstation  (vlax-get profview 'stationend)
            midstation  (/ (+ startstation endstation) 2)
      )
      (setq align (vlax-get profview 'parent))
      (vla-highlight align :vlax-true)
      (if (and (> sta (vlax-get align 'startingstation))
               (< sta (vlax-get align 'endingstation))
               )
        (setq midstation sta)
        )
      (vlax-invoke-method align 'pointlocation midstation 0 'x 'y)
      (setq pnt (list x y))
      (command "zoom" "c" pnt 200)
      (princ "Zoomed to Alignment.")
    )
  )
  (princ)
)

 

Thanks for the help.

Link to comment
Share on other sites

Have a look at Civil Site Design its built in, when in a design profile a matching plan view will show where you are on a profile a moving little bar. Works with CIV3D or Bricscad.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...