Create Centre Lines in Paper Space

Create Centre Lines in Paper Space

Phil
Advocate Advocate
1,103 Views
9 Replies
Message 1 of 10

Create Centre Lines in Paper Space

Phil
Advocate
Advocate

Hi all

 

 

We are using AutoCAD Plant 3D 2015 for plant modelling and automatic creation of Paper Space Ortho Views.

 

I have been told in the Plant 3D forum that a feature has been added to the 2017 version to enable placing of centre lines in paper space for vessels and ductwork.  As we are not in a position to upgrade yet, I was wondering whether it was possible to capture the size of a paperspace circle and use it in a lisp routine to create single-click centre lines.

It is clearly possible on some level, because the Diameter Dimension manages to correctly label the circle in paper space.

 

Anyone ever looked into this please?

 

 

Phil

 

0 Likes
Accepted solutions (1)
1,104 Views
9 Replies
Replies (9)
Message 2 of 10

phanaem
Collaborator
Collaborator

Hi

Please try this and let me know if I got it right.

If you want to change the layer, you can edit the lisp and change the "AXIS" layer name to whatever you want.

 

(defun c:ccen ( / acdoc ss i c o r lo vp sc o1)
  (setq acdoc (vla-get-activedocument (vlax-get-acad-object)))
  (if
    (= (getvar 'tilemode) 0)
    (progn
      (setq lo (cons 410 (getvar 'ctab)))
      (vla-put-mspace acdoc :vlax-true)
      (while
        (setq ss (ssget '((0 . "CIRCLE") (410 . "Model"))))
        (repeat (setq i (sslength ss))
          (setq c (entget (ssname ss (setq i (1- i))))
                o (cdr (assoc 10 c))
                r (cdr (assoc 40 c))
                vp (entget (ssname (ssget "_X" (list '(0 . "VIEWPORT") lo (cons 69 (getvar 'cvport)))) 0))
                sc (/ (cdr (assoc 41 vp)) (cdr (assoc 45 vp)))
                o1 (trans (trans o 0 2) 2 3)
                )
          (entmake
            (list
              '(0 . "LINE")
              '(8 . "AXIS")
              lo
              (cons 10 (mapcar '- o1 (list (* -1.1 r sc) 0.0)))
              (cons 11 (mapcar '- o1 (list (*  1.1 r sc) 0.0)))
            )
          )
          (entmake
            (list
              '(0 . "LINE")
              '(8 . "AXIS")
              lo
              (cons 10 (mapcar '- o1 (list 0.0 (* -1.1 r sc))))
              (cons 11 (mapcar '- o1 (list 0.0 (*  1.1 r sc))))
            )
          )
        )
      )
      (vla-put-mspace acdoc :vlax-false)
    )
  )
  (princ)
)

 

Message 3 of 10

Phil
Advocate
Advocate

Hi Phanaem

 

Good news and bad with this!

I have tried it with a straight forward circle drawn in model space and this works great for "centre lining" the circle in a paperspace view port.

 

The problem is that the "Circles" I am trying to add centre lines to are paperspace views on solid cylindrical vessels.  They just appear as circles because of the plan view clipping plane used to generate the view (hope that is a clear explanation).

 

Thanks for the code though

 

 

Phil

0 Likes
Message 4 of 10

dgorsman
Consultant
Consultant

Well, you *did* ask for circles in the first post...  What you're actually after is cylindrical objects (not 3D solids, even) viewed end-on through a viewport.  And maybe side-on as well?

 

I would suggest that you use a dynamic block with a stretch (and maybe a rotate) action for the side view.  You might get away with a visibility state for side view if you want to keep it to a single, standardized block.  Placement wouldn't be single-click but with some judicious use of OSNAPS it shouldn't be too bad.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 5 of 10

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

...

I have tried it with a straight forward circle drawn in model space and this works great for "centre lining" the circle in a paperspace view port.

 

The problem is that the "Circles" I am trying to add centre lines to are paperspace views on solid cylindrical vessels. ....


For me, DIMCENTER with appropriate Dimension Variable settings, used in Paper Space, works to put center-lines in circular things in Model Space in a Viewport, whether they're Circles, circular Polylines [with or without thickness], 3D Solids [such as made by Extruding a Circle], or Surfaces [such as made by Extruding a vertical Line along a circular path].  Are yours some other entity type?  Are you trying to do something different from what it sounds like to me from your description?  Am I missing something?

Kent Cooper, AIA
0 Likes
Message 6 of 10

stevor
Collaborator
Collaborator

1. The errors in English are just as bad as  typos in code.

 

2. Kent's method works fine, and faster with the onject snap as center.

 

3. Automation [Autocad] may be done by exploding the 3DSOLIDs to

Regions then Circles, where the DimCenter command will accept

an entity name and a point, precerably the center, as a list;

like an return of 'entsel...

S
0 Likes
Message 7 of 10

Phil
Advocate
Advocate

OK Kent

 

 

So where do I find that gem in the AutoCAD/Plant toolbar maze?

 

I've been looking all over for that one in dimension toolbars and similar.

Is it selectable via a menu, or is it only available as a command line item?

 

Many thanks

 

 

Phil

0 Likes
Message 8 of 10

dgorsman
Consultant
Consultant

That's a relatively new addition.  I'm not certain it was added for the 2015 line of products.  Try the command search under the Application Icon and see what it finds.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 9 of 10

Kent1Cooper
Consultant
Consultant
Accepted solution

@Anonymous wrote:

OK Kent 

 

So where do I find that gem in the AutoCAD/Plant toolbar maze?

....


Here from Acad2016's unaltered ribbon -- Annotate tab, Dimension panel [pick on its little pull-down at the bottom to get the sub-panel shown] :

 

dimcenter.png

 

I say "unaltered" because I didn't customize it to bring that command in, but you can, if for some reason yours doesn't include it.

Kent Cooper, AIA
Message 10 of 10

Kent1Cooper
Consultant
Consultant

@dgorsman wrote:

That's a relatively new addition.  I'm not certain it was added for the 2015 line of products.  ....


If you're referring to the DIMCENTER command, it most certainly is not a new addition -- it's been around for decades, if not possibly for as long as any kind of Dimensioning has been around.

Kent Cooper, AIA
0 Likes