Seek a lisp to change revclound to Polygon with specific layer and linetype and linetype scale

Seek a lisp to change revclound to Polygon with specific layer and linetype and linetype scale

skchui6159
Advocate Advocate
1,207 Views
18 Replies
Message 1 of 19

Seek a lisp to change revclound to Polygon with specific layer and linetype and linetype scale

skchui6159
Advocate
Advocate

Can anyone can provide a lisp a seek to change like that:

Before

skchui6159_0-1731372209170.png

skchui6159_2-1731372255490.png

 

After (use the point of recloud)

skchui6159_1-1731372223774.png

before

skchui6159_3-1731372270847.png

skchui6159_4-1731372298815.png

 

 

0 Likes
Accepted solutions (4)
1,208 Views
18 Replies
Replies (18)
Message 2 of 19

paullimapa
Mentor
Mentor
0 Likes
Message 3 of 19

skchui6159
Advocate
Advocate

Can you upgrade the lisp by ssget? And Specific layer. 

0 Likes
Message 4 of 19

paullimapa
Mentor
Mentor
Accepted solution

Try the attached modified: REV2REC.lsp for rectangles

And Rev2Poly.lsp for polygons


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 5 of 19

Kent1Cooper
Consultant
Consultant
Accepted solution

@paullimapa wrote:

Try the attached modified: REV2REC.lsp for rectangles   And Rev2Poly.lsp for polygons


The REV2REC doesn't really care whether the original is rectangular, whether or not it was made with the Rectangle option in REVCLOUD, but simply takes the outermost extents of the vertices of any shape of arc-segments-only Polyline, and builds a rectangle around them.  I find REVCLOUD's Rectangle option doesn't always even make a 4-edge result anyway -- this was drawn with it [6 grips, 10 arc segments, decidedly diagonal in places]:

Kent1Cooper_0-1731439951255.png

Typical of Revcloud Polylines, it has more than one arc segment along some of the grip-defined "edges."  But some Revclouds don't even have any vertices falling on the grip locations:

Kent1Cooper_1-1731440241091.png

I assume (?) the OP wants those grip-defined "edges" used to draw the no-arcs conversion, but I'm not sure how they can be derived in a situation like that -- entity data has only the vertex locations at the ends of the arc segments.

 

The REV2POLY command simply draws the straight-line-segment version through all the arc-segment vertices, ignoring the possibility of multiple arc segments along a given "edge."  If that will suffice, there a much easier way to get that -- simply strip out all the bulge-factor entries from entity data, and it will use zero for all segments:

(defun C:REV2POLY (/ pl pldata)
  (setq
    pl (car (entsel))
    pldata (entget pl)
  )
  (entmod (vl-remove-if '(lambda (x) (= (car x) 42)) pldata))
  (prin1)
)

The Polyline retains its Layer and all other properties -- it only gets its arcs all straightened.  [A check on appropriate selection could be added, etc.]  But that results in more edges than the grips of a Revcloud-variety Polyline suggest.

 

What I don't understand is how AutoCAD "knows" that a given Polyline is a Revcloud.  I tried Exploding one and PEDIT-Joining the Arcs back together, assuming it would "break" the definition, but it still knew, so I suspect it's that it has only arc segments, and all with the same specific bulge factor.  But how does it come up with the oddball grip locations in the second image above?  I don't find anything defining the difference in the DXF reference, or entity data, and they have no extended data.  If whatever that is can be determined, maybe something could be done that would actually follow the smaller number of grip-defined edges, rather than the larger number of vertices.

Kent Cooper, AIA
Message 6 of 19

skchui6159
Advocate
Advocate

Thank you for lisp. However I found that for the lisp of revc2poly, if I go to the layout page, the effect of lineweight and divide can not be adopted like that:

When creating object of by using revcpolygon below (revc rectangle is ok).

skchui6159_0-1731442364320.png

 

 

How can resolve this?

0 Likes
Message 7 of 19

Kent1Cooper
Consultant
Consultant

@skchui6159 wrote:

.... for the lisp of revc2poly, if I go to the layout page, the effect of lineweight and divide can not be adopted like that:

When creating object of by using revcpolygon ....


No posted code uses revc2poly as a command name.  Which or whose routine are you talking about?  If you use the REPLY button within the Message you're Replying to, we might be able to tell.  When you use the "Reply to the Topic..." slot below the last Message, it always shows as being in Reply to the author of Message 1 [yourself in this case].  Mine doesn't deal with linetype or Layer yet, but those are easily included.

 

And by "using revcpolygon" do you mean the REVCLOUD command and it Polygonal option?

Kent Cooper, AIA
0 Likes
Message 8 of 19

paullimapa
Mentor
Mentor

Post a sample dwg where you're having trouble seeing the linetype develop in your vport layout.

Typically the problem has to do with PSLTSCALE, LTSCALE & MSLTSCALE


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 9 of 19

paullimapa
Mentor
Mentor

Starting with 2021 the Revcloud is somehow recognize as a separate object than a Polyline

If you run this code and it includes that in the Classname is the only way I know to determine what the selected object really is:

(getpropertyvalue (car(entsel)) "Classname")

Polyline would return: ""

Revcloud would return: "AcDbPolyline (Revcloud)"


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 10 of 19

skchui6159
Advocate
Advocate

Sorry, I should reply the above lisp with reply button. In Rev2Poly.lsp, if create object in layout (not model space) the revclound it can not be use to change the lineweight.

Before using Rev2Poly

skchui6159_0-1731452937659.png

 

After:

skchui6159_1-1731452968203.png

 

0 Likes
Message 11 of 19

skchui6159
Advocate
Advocate

Your lisp works (sample version of REV2POLY) on layout page. If I use in layout page and change the lineweight and linetype scale in layout page, it is ok!

 

 

 

0 Likes
Message 12 of 19

skchui6159
Advocate
Advocate

Sorry, I am talking about above long version of rev2poly.lsp.

 

0 Likes
Message 13 of 19

ronjonp
Mentor
Mentor

@paullimapa wrote:

Starting with 2021 the Revcloud is somehow recognize as a separate object than a Polyline

If you run this code and it includes that in the Classname is the only way I know to determine what the selected object really is:

(getpropertyvalue (car(entsel)) "Classname")

Polyline would return: ""

Revcloud would return: "AcDbPolyline (Revcloud)"


@paullimapa It is also stored as XDATA: 

(-3 ("RevcloudProps" (1070 . 0) (1040 . 9.0)))
Message 14 of 19

skchui6159
Advocate
Advocate

Sir, this is the attached sample dwg

0 Likes
Message 15 of 19

paullimapa
Mentor
Mentor
Accepted solution

Looks like in Model space your linetype scale is set at 0.5 but in Paper space it's set to 0.15.

So I modified the attached Rev2Poly.lsp to show this difference.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 16 of 19

Sea-Haven
Mentor
Mentor
Accepted solution

Not sure were I got this.

 

(defun c:getXData ( / ename edata )
  (if (setq ename (car (entsel "\nSelect entity to read xdata: ")))
    (progn
      (setq edata (entget ename '("*")))
      (if (setq xdata (cdr (assoc -3 edata)))
        (foreach item xdata
          (print item)
        )
        (princ "\nEntity has no xdata.")
      )
    )
  )
  (princ)
)
0 Likes
Message 17 of 19

skchui6159
Advocate
Advocate

Thank you very much!

0 Likes
Message 18 of 19

paullimapa
Mentor
Mentor

You are welcome….cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 19 of 19

skchui6159
Advocate
Advocate

Well done, Yeah! Thank you very much! CHEER!!!!

skchui6159_0-1731510026296.png

 

0 Likes