Lisp to automatically set all profile views to "Automatic height"

Lisp to automatically set all profile views to "Automatic height"

Anonymous
Not applicable
2,516 Views
9 Replies
Message 1 of 10

Lisp to automatically set all profile views to "Automatic height"

Anonymous
Not applicable

Hey everyone,

 

I've been given the task of standardizing the plan production process for our office. We have a few big waterline projects coming up that require up to 100 profile views per sheet set.

 

My current workflow is as follows ->

1) I create all the profile views using plan production (this automatically sets each profile view to User specified height according to the template I use)

2) One by one, I  set the Elevation range to "Automatic height" for each profile view (Profile View properties -> Elevations)

3) I select all of the  profile views at once, and I move them up about 5' in model space (this gets them to fit perfectly in our paper space layouts)

4) I adjust each profile view's elevation range manually (Profile View properties -> Elevations)

 

I lose a lot of time on step 2, especially as I work with very large sheet sets. This seems like something I could automate with a lisp routine. Does anyone know of a way to write a lisp routine that could select all profile views in a drawing and set their elevation range to "Automatic height"?

 

Thanks!

 

-CJ-

Accepted solutions (2)
2,517 Views
9 Replies
Replies (9)
Message 2 of 10

Jeff_M
Consultant
Consultant
Accepted solution

Here ya go.

(defun c:allpv2autoelev (/ ss idx ent pv)
(vl-load-com) (if (setq ss (ssget "X" '((0 . "AECC_PROFILE_VIEW")))) (progn (setq idx -1) (while (setq ent (ssname ss (setq idx (1+ idx)))) (setq pv (vlax-ename->vla-object ent)) (if (eq (vlax-get pv 'elevationlocked) -1) (vlax-put pv 'elevationlocked :vlax-false) ) ) ) ) (princ) )
Jeff_M, also a frequent Swamper
EESignature
Message 3 of 10

Anonymous
Not applicable

Worked like a charm.

 

Thanks!

 

-CJ-

0 Likes
Message 4 of 10

Anonymous
Not applicable

Jeff,

 

I just ran into another issue which has me stumped. I encountered a problem with the lisp when it gets used on a profile view that has the "Split profile view" option checked.

 

It looks like the elevations get set to automatic height ok, but the profile views won't update or display correctly until I manually open up the profile view properties and click apply or OK. This unchecks the Split profile view box, and fixes the profile view.

 

Unfortunately, I'm not seeing an ActiveX object property that deals with the split profile view, otherwise i could just disable it first and then switch to the automatic height in the lisp. I'm only seeing the 'elevationlocked property which I think handles everything together. I've attached some pictures that show the issue.

 

Any ideas?

 

Thanks!

 

-CJ-

0 Likes
Message 5 of 10

Jeff_M
Consultant
Consultant
Accepted solution
Sorry CJ, looks like another missing item in the COM API. I'm not seeing a way to get around this.
Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 6 of 10

Anonymous
Not applicable

That's what I thought. I'll find a workaround by changing our workflow process a little bit.

 

Thanks!

 

-CJ-

0 Likes
Message 7 of 10

Anonymous
Not applicable

Jeff

 

I'm trying to define the station and elevation ranges by a lisp.

 

I was hoping there was a way to store the ranges in a separate .txt file that the lisp pulls the range data from and when I execute the command, I can choose the profile views the lisp would apply the ranges to.

 

Is that possible?

 

Keone

0 Likes
Message 8 of 10

ddrennen2QDK2
Enthusiast
Enthusiast

Hello jeff.  any chance you can update this code to also adjust the stations to automatic?

thanks in advance for your help.

0 Likes
Message 9 of 10

Jeff_M
Consultant
Consultant

@ddrennen2QDK2 

(defun c:allpv2autoelev (/ ss idx ent pv)
  (vl-load-com)
  (if (setq ss (ssget "X" '((0 . "AECC_PROFILE_VIEW"))))
    (progn
      (setq idx -1)
      (while (setq ent (ssname ss (setq idx (1+ idx))))
	(setq pv (vlax-ename->vla-object ent))
	(if (eq (vlax-get pv 'stationlocked) -1)
	  (vlax-put pv 'stationlocked :vlax-false)
	  )
	(if (eq (vlax-get pv 'elevationlocked) -1)
	  (vlax-put pv 'elevationlocked :vlax-false)
	  )
	)
      )
    )
  (princ)
  )
Jeff_M, also a frequent Swamper
EESignature
Message 10 of 10

artirtas9100
Explorer
Explorer

Hi all,

When you manipulate eg Sample Lines in model (moving, adding) these changes don't show up immediately in a profile view.

You have to go to the properties of the profile view and then hit apply after every change or hit Automatic Update

How to do this with a lisp: just get all PV's and hit apply lisp-wise to make them up to date: 

this should be AeccAutoRefreshProfileBand / Automatic Update, but for all PV's

 

Thanks in advance for any help.

Regards,

A.

0 Likes