Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I currently use a tool caled Steamroller, how do I best add a step?

21 REPLIES 21
SOLVED
Reply
Message 1 of 22
claimed4all
1150 Views, 21 Replies

I currently use a tool caled Steamroller, how do I best add a step?

I currently use a tool called Steamroller.lsp

 

I have editited it once to have it ask you before running the operation.

 

So right now you run the tool

You get a prompt to run the tool

It grabs all the Survey Figure Lines, explodes them

Figures become 3D polylines

3D polylines are flattened and become 2D polylines

 

My surveyor would love it if the tool had one more step, so it would run like this:

 

You get a prompt to run the tool

It grabs all the Survey Figure Lines, explodes them

Figures become 3D polylines

**A copy is made of all 3D polylines and moved to LAYER-XXXXX**

3D polylines (the once not copied to new layer) are flattened and become 2D polylines

 

Is this possible?  In the realm of a non programmer to do or will I probably be hiring this out?

21 REPLIES 21
Message 2 of 22
hmsilva
in reply to: claimed4all

One way,
change

(if (setq C3DOBJ (ssget "X" '((0 . "POLYLINE*"))))
  (command "AeccConvert3dPolys" C3DOBJ "")
)

 to

(if (setq C3DOBJ (ssget "X" '((0 . "POLYLINE*"))))
  (progn
    (vl-load-com)
    (if (not (tblsearch "LAYER" "LAYER-XXXXX"));; change the LayerName 
      (command "_.layer" "_N" "LAYER-XXXXX" "");; change the LayerName 
    )
    (repeat (setq i (sslength C3DOBJ))
      (setq obj (setq VlaObj (vlax-ename->vla-object (ssname C3DOBJ (setq i (1- i))))))
      (setq new (vla-copy obj))
      (vla-put-Layer new "LAYER-XXXXX");; change the LayerName 
    )
    (command "AeccConvert3dPolys" C3DOBJ "")
  )
)

 

Hope that helps
Henrique

EESignature

Message 3 of 22
claimed4all
in reply to: hmsilva

Works great!  Thank You!  I think I can fumble through the code at this point and have it create the LAYER-XXXX if that layer is not present in the drawing.  If that layer is not present I get an error, it it is present then it works great. 

Message 4 of 22
hmsilva
in reply to: claimed4all


@claimed4all wrote:

Works great!  Thank You!  I think I can fumble through the code at this point and have it create the LAYER-XXXX if that layer is not present in the drawing.  If that layer is not present I get an error, it it is present then it works great. 



You're welcome, claimed4all.
It should not giva an error if layer don't exist...
See if the layer name is correctly written in all places that has changed
Henrique

EESignature

Message 5 of 22
claimed4all
in reply to: hmsilva

Hmm...  Back to the drawing board.

 

I added just the lines you said, left the LAYER-XXXX and the tool seems to skip copying over the 3D polylines to that layer.  I will look at the code more in depth and see if I can my error.  Still breaks them to 2D polylines, just skips the step and does not create the LAYER-XXXX.

 

Thanks again for the help.

Message 6 of 22
hmsilva
in reply to: claimed4all


@claimed4all wrote:

Hmm...  Back to the drawing board.

 

I added just the lines you said, left the LAYER-XXXX and the tool seems to skip copying over the 3D polylines to that layer.  I will look at the code more in depth and see if I can my error.  Still breaks them to 2D polylines, just skips the step and does not create the LAYER-XXXX.


Attach the modified code, if possible.

 

EDIT: try the attached code, if don't run as expected, in a new dwg copy/paste to the commandline

(command "_.layer" "_N" "LAYER-XXXXX" "")

what is the return, did the "LAYER-XXXXX" was created?

 

 

Henrique

EESignature

Message 7 of 22
_Tharwat
in reply to: hmsilva

You have an extra setq variable .

 

(setq VlaObj .....

 

Message 8 of 22
claimed4all
in reply to: hmsilva

Modified code is attasched.

Message 9 of 22
claimed4all
in reply to: _Tharwat

I see that.  I tried to remove it but I get an error.  Like I said, I mostly fumble through these codes.  How would I correct this issue?  I attached the updated code on my previous post.

Message 10 of 22
hmsilva
in reply to: _Tharwat


@_Tharwat wrote:

You have an extra setq variable .

 

(setq VlaObj .....

 


Good catch Tharwat!

Thanks!

 

Cheers

Henrique

 

 

EESignature

Message 11 of 22
hmsilva
in reply to: claimed4all

Sorry, my bad!

 

Try the revised code...

 

Henrique

 

EESignature

Message 12 of 22
claimed4all
in reply to: hmsilva

Interesting.  Works as orginally.  Tool dumbs everything down to a 2D polyline.  The tool is skipping the step of putting a copy of of the 3D polylines on layer LAYER-XXXXX

Message 13 of 22
hmsilva
in reply to: claimed4all


@claimed4all wrote:

Interesting.  Works as orginally.  Tool dumbs everything down to a 2D polyline.  The tool is skipping the step of putting a copy of of the 3D polylines on layer LAYER-XXXXX


Is the layer LAYER-XXXXX created?

 

Henrique

EESignature

Message 14 of 22
claimed4all
in reply to: hmsilva

No, the layer is NOT created.

Message 15 of 22
hmsilva
in reply to: claimed4all

copy/paste at commandline
(command "_.layer" "_N" "LAYER-XXXXX" "")
Is the layer LAYER-XXXXX created?

Henrique

EESignature

Message 16 of 22
claimed4all
in reply to: hmsilva

Yes, If I copy that into my command line the layer is created.

Message 17 of 22
hmsilva
in reply to: claimed4all

I'm not a C3D guy, but the code should work as expected...

 

Delete the layer and copy/paste to the command line

(not (tblsearch "LAYER" "LAYER-XXXXX"))

what is the return?

 

Henrique

EESignature

Message 18 of 22
claimed4all
in reply to: hmsilva

The return is T

Just a T.

 

Message 19 of 22
hmsilva
in reply to: claimed4all


@claimed4all wrote:

The return is T

 


T is the expected return...

 

The code should work as expected...

 

In a new dwg, draw some 3dpolylines, load this code snippet, and type demo.

 

(defun c:demo ( / C3DOBJ I NEW OBJ)
  (if (setq C3DOBJ (ssget "X" '((0 . "POLYLINE*"))))
    (progn
      (vl-load-com)
      (if (not (tblsearch "LAYER" "LAYER-XXXXX"))
        (command "_.layer" "_N" "LAYER-XXXXX" "")
      )
      (repeat (setq i (sslength C3DOBJ))
        (setq obj (vlax-ename->vla-object (ssname C3DOBJ (setq i (1- i)))))
        (setq new (vla-copy obj))
        (vla-put-Layer new "LAYER-XXXXX")
      )
      (command "AeccConvert3dPolys" C3DOBJ "")
    )
  )
  (princ)
)

 

Henrique

 

EESignature

Message 20 of 22
claimed4all
in reply to: hmsilva

That code right there worked as inteded.  It copied my 3D polylines to layer LAYER-XXXXX and then it took the original 3D polylines and turned them into basic polylines.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost