Jump to content

Recommended Posts

Posted (edited)

Shay, like you had hunch for mistake... Code was updated once more...

 

That line is just for converting old heavy polyline from sel. set of heavy polylines to LWPOLYLINE, that are in the end of code converted back like there were no modifications...

Edited by marko_ribar
  • Replies 29
  • Created
  • Last Reply

Top Posters In This Topic

  • samifox

    11

  • marko_ribar

    8

  • MSasu

    4

  • pBe

    4

Top Posters In This Topic

Posted Images

Posted

What entity name the old poly line has?

Posted

The entity name (that it, stored under DXF code -1) of old type (also known as heavy) polyline is POLYLINE.

Posted
The entity name (that it, stored under DXF code -1) of old type (also known as heavy) polyline is POLYLINE.

 

Marko code never acquire entity by -1 , he always acquire it by wildcard search *POLYLINE. so i hardly get sense of it

Posted

Look Shay, this line :

 

(setq ss (ssget "_I" '((0 .  "*POLYLINE") (-4 . "<and") [color=red](-4 . "<not") (-4 .  "&=") (70 .  (-4 . "not>")[/color] [color=blue](-4 . "<")  (70 . 130)[/color] (-4 . "and>"))))

 

filters all entities both LWPOLYLINE and POLYLINE (that's why "*POLYLINE") - marked red are those entities that are not 3d polylines, and marked blue are only polylines that don't have smoothness (fit/quadratic/cubic) - this is referenced to old heavy 2d polylines (POLYLINE entities - not LWPOLYLINE entities)... If you look closer to DXF 70 codes for (fit/quadratic/cubic) POLYLINE entities (2d - 3d we already filtered out), you'll see that their values are greater than 129 - this is why (-4 . "

 

So when selection is made - sel.set will contain only entities on witch code can perform operations - so then we differ only LWPOLYLINE in one side and POLYLINE on the other side... If LWPOLYLINE entity is to be processed (plintav) sub-function can operate correctly, but if POLYLINE entity (that is 2d old heavy polyline) is to be processed they have to be converted to LWPOLYLINE entity, then (plintav) will process them, and then in the end they are converted back to POLYLINE entities...

(command "_.convertpoly" "h" [or] "l" ent "") - "h" stands for conversion of LWPOLYLINE to old heavy 2d POLYLINE, and "l" stands for opposite conversion...

 

HTH

Posted
wildcard search *POLYLINE

For the wildcard options you may check the help of WCMATCH function.

Posted
Look Shay, this line :

 

(setq ss (ssget "_I" '((0 .  "*POLYLINE") (-4 . "<and") [color=red](-4 . "<not") (-4 .  "&=") (70 .  (-4 . "not>")[/color] [color=blue](-4 . "<")  (70 . 130)[/color] (-4 . "and>"))))

 

filters all entities both LWPOLYLINE and POLYLINE (that's why "*POLYLINE") - marked red are those entities that are not 3d polylines, and marked blue are only polylines that don't have smoothness (fit/quadratic/cubic) - this is referenced to old heavy 2d polylines (POLYLINE entities - not LWPOLYLINE entities)... If you look closer to DXF 70 codes for (fit/quadratic/cubic) POLYLINE entities (2d - 3d we already filtered out), you'll see that their values are greater than 129 - this is why (-4 . "

 

So when selection is made - sel.set will contain only entities on witch code can perform operations - so then we differ only LWPOLYLINE in one side and POLYLINE on the other side... If LWPOLYLINE entity is to be processed (plintav) sub-function can operate correctly, but if POLYLINE entity (that is 2d old heavy polyline) is to be processed they have to be converted to LWPOLYLINE entity, then (plintav) will process them, and then in the end they are converted back to POLYLINE entities...

(command "_.convertpoly" "h" [or] "l" ent "") - "h" stands for conversion of LWPOLYLINE to old heavy 2d POLYLINE, and "l" stands for opposite conversion...

 

HTH

 

Hi

 

thanks for your explanation ,

 

first of all i still analyzing your code, and learn a lot by it :)

 

in general your goal was to turn all entities to LWPOLYLINE , and then to VLA-OBJECT,

 

why not directly to VLA-OBJECT?

 

 

than you send each pair of entities to intersection test, and construct a list of intersection points

 

by analyzing this part of the code , i have some questions :

 

1. Variable l , it seems it was misplaced there, correct?

2. why the index p is advanced and then going backward?

3. LM:Unique definition and flow is is really confusing me, could you explain please?

 

 

(defun LM:Unique ( lst )
   (if lst (cons (car lst) (LM:Unique (vl-remove (car lst) (cdr lst)))))
 )

 (defun AT:GetVertices ( e / p l )
   (LM:Unique
     (if e
       (if (eq (setq p (vlax-curve-getEndParam e)) (fix p));_make sure that the vertex is really sitting on the end
         (repeat (setq p (1+ (fix p)))
           (setq l (cons (vlax-curve-getPointAtParam e (setq p (1- p))) l));
         )
         (list (vlax-curve-getStartPoint e) ;
         (vlax-curve-getEndPoint e));_
       )
     )
   )
 )

Posted
3. LM:Unique definition and flow is is really confusing me, could you explain please?

(defun LM:Unique ( lst )
   (if lst (cons (car lst) (LM:Unique (vl-remove (car lst) (cdr lst)))))
)

 

LM:Unique is taken from here ;)

Posted
Look Shay, this line :

 

(setq ss (ssget "_I" '((0 .  "*POLYLINE") (-4 . "<and") [color=red](-4 . "<not") (-4 .  "&=") (70 .  (-4 . "not>")[/color] [color=blue](-4 . "<")  (70 . 130)[/color] (-4 . "and>"))))

filters all entities both LWPOLYLINE and POLYLINE (that's why "*POLYLINE") - marked red are those entities that are not 3d polylines, and marked blue are only polylines that don't have smoothness (fit/quadratic/cubic)

 

 

Marko, not work, maybe like this:

 

(setq ss
        (ssget
            '(
                (0 . "*POLYLINE")
                (-4 . "<and")
                    (-4 . "<not") (-4 . "&=") (70 .  (-4 . "not>")
                    (-4 . "<not") (-4 . "&=") (70 . 2) (-4 . "not>")
                    (-4 . "<not") (-4 . ">") (75 . 0) (-4 . "not>")
                (-4 . "and>")
            )
        )
)

Posted
Marko, not work, maybe like this:

 

(setq ss
        (ssget
            '(
                (0 . "*POLYLINE")
                (-4 . "<and")
                    (-4 . "<not") (-4 . "&=") (70 .  (-4 . "not>")
                    (-4 . "<not") (-4 . "&=") (70 . 2) (-4 . "not>")
                    (-4 . "<not") (-4 . ">") (75 . 0) (-4 . "not>")
                (-4 . "and>")
            )
        )
)

 

i think marko just wanted to explain , not to compile ;)

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...