Jump to content

AutoLisp for ZWcad


Costinbos77

Recommended Posts

Hi gents ,

 

This section of the forum "AutoLisP , Visual LisP & DCL" is ONLY for AutoCAD , or can be used for any other software which is working with this kind of files ?

 

Sorry if I asked a silly question .

Link to comment
Share on other sites

The below code is working fine in AutoCAD .

 

 (setq r (/ (getVar "ViewSize") 80)  r- (- r)  p '(10 7 0)
       transL (list (list 1  0. 0. (car p)) (list 0. 1  0. (cadr p)) (list 0. 0. 1 (caddr p)) (list 0. 0. 0. 1.) )  )

 (grVecs (list 1 (list r- r-) (list r r-) 2 (list r r-) (list r r) 3 (list r r) (list r- r) 4 (list r- r) (list r- r-) ) transL)

But in ZWcad the variable list transL doesn't have any effect . The rectangle is going in origin  , no matter where point p is . 

It is not an oSnap issue .

 

The colored square should be inside of the circle .

 

Any suggestion ?

grVecs.jpg

Edited by Costinbos77
Link to comment
Share on other sites

The Grvecs is (list color pt1 pt2 color pt2 pt3 color pt3 pt24 etc. This worked for me.

 

(grVecs (list 1 (list r- r-) (list r r-) 2 (list r r-) (list r r) 3 (list r r) (list r- r) 4 (list r- r) (list r- r-) ))

But it is in wrong spot. 

tansl does not make sense
((1 0.0 0.0 10) (0.0 1 0.0 7) (0.0 0.0 1 0) (0.0 0.0 0.0 1.0))

 

(setq transl (list 1 (list 7 4) (list 13 4) 2 (list 13 4) (list 13 10) 3 (list 13 10) (list 7 10) 4 (list 7 10) (list 7 4)))
(grVecs transl)

 

Link to comment
Share on other sites

Thanks BigAl.

 

1. But unfortunately , I really need the transL list , because P is not static , it is dynamic , from grRead sequence. I don't put it in my example because I wanted it to be easy & simple one .

So , I need the rectangle to move simultaneously with the mouse cursor .

 

2. I received the ensure from ZWcad , saying grVecs can have a bug . They will check .

 

The below code has the same result as my one .

(grVecs (list 1 (list r- r-) (list r r-) 2 (list r r-) (list r r) 3 (list r r) (list r- r) 4 (list r- r) (list r- r-) ) nil)

That means is not interpreting my transL list .

 

3. To avoid all of this , I can use plan B : to calculate myself all 4 corners :

(setq c1 (mapcar '+ p (list r- r-)) )
(setq c2 (mapcar '+ p (list r r-)) )
(setq c3 (mapcar '+ p (list r r)) )
(setq c4 (mapcar '+ p (list r- r)) )

(grVecs (list 1 c1 c2 2 c2 c3 3 c3 c4 4 c4 c1) nil)

That will work very well in this case .

 

But , this means I need to calculate myself all the time in my other programs when I use the function grVecs with a translation list .

 

Unfortunately , for my oSnap function ,  grVecs is using 3 , 4 corners or multiple dots to simulate a circle . In that case , will be a nightmare without a  translation list .

 

I hope ZWcad will fix the problem .

 

Edited by Costinbos77
Link to comment
Share on other sites

That is what you have to do with grvecs keep changing the pt values, the other way is make a rectang, then use move you can get the 4 corner values once you finish dragging, then erase rectang.

Link to comment
Share on other sites

i think, it is true that zwcad has a problem in grvec trans.

In zwcad, Lee Mac's GrSnap is also fixed to the origin in the same way and does not work.

 

There are still a few more bugs remaining in zwcad. 

For example, if user run a Lisp containing LM:ENDUNDO LM:STARTUNDO.

sometimes It has to return a flag and escape the while, but it continues to run while infinitely

It seems like they only considered simply turning the flag on and off. I think the priorities are weird.

this is very critical problem but has not been fixed in 2019, 2022.

 

and acet-, ai-, control a zwcad in VBA, script writer, object DBX... etc.

with a little effort, most things are possible in zwcad. but it feels like some screw is missing. I think grvecs is like that too.

Edited by exceed
Link to comment
Share on other sites

* Thanks BigAl ,

 

This can be a good plan C as well . The problem with this approach is the rectangle will influence the Osnap . But yes , can be applied in some cases .

 

* Thanks @exceed .

 

I was guessing ZWcad is not as stable as AutoCAD . It is not my choice , but I need to adapt my lisps to ZWcad as well , because some people are migrating to it .

To be honest , I was expecting more incompatibilities .

 

The major one is not compiling Line files .shp in .shx .

 

By the way , @exceed :

1 . Did you manage to load files for complex lines as  .shx .

2. Do you know a dedicated forum for AutoLisp for ZWcad ?

 

Thanks in advance .

Edited by Costinbos77
Link to comment
Share on other sites

Sorted :

 

1 . User Complex lines .

in AutoCAD :

;;  These linetype definitions use LTYPESHP.SHX.
;;
*FENCELINE1,Fenceline circle ----0-----0----0-----0----0-----0--
A,.25,-.1,[CIRC1,lTypeShp.shx,x=-.1,s=.1],-.1,1

 

My customized complex line :

;;  These linetype definitions use MyFile.SHX.
;;
*MYLINE,Line with circle ----0-----0----0-----0----0-----0--
A,.25,-.1,[CIRC1,MyFile.shx,x=-.1,s=.1],-.1,1

 

AutoCAD can search and read the file MyFile.shx if it is in the searching path .

 

ZWcad can access only the file lTypeShp.shx . So , if all the user's definitions for complex lines are included there , will work fine .

Of course , lTypeShp.shx file is coming from compiled lTypeShp.shp .

 

2 . ZWcad ensured NO dedicated forum for AutoLisp for ZWcad at the moment .

 

Edited by Costinbos77
Link to comment
Share on other sites

Did you contact ZWcad for help ?

 

CAD Forum - How to convert font and shape files SHX back to SHP?

https://www.cadforum.cz/en/how-to-convert-font-and-shape-files-shx-back-to-shp-tip11041

 

Add yours then do shp to shx 

 
https://www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/Compile-shape-file-into-SHX-text-font-file.html

 

Pretty sure there is a mkshx program.

Edited by BIGAL
Link to comment
Share on other sites

Hi BigAl ,

 

Yes, I sent them an email about this . Will see .

 

Great , your links are brilliant ! I didn't know could reverse .shx to .shp .

Was very hard to run it , until I found this guide for dumpshx.exe .

I will reproduce it below in case the link disappears :

1. Copy file from "C:\Program Files\Autodesk\AutoCAD 20??\Express\dumpShx.exe" to short and easy path "C:\Test\dumpShx.exe"

You can even rename the file as "c:\1\d.exe" , TO BE EASY TO WRITE IN the COMMAND PROMPT .

2. Open Command Prompt for Windows , usually by writing in the down-left box .

3. Write to go in your Desired director : cd c:\test\ ;

4. Write all in ONE LINE as  :   dumpShx.exe   -o  c:\test\ltypeshp.shp    c:\test\ltypeshp.shx  and press ENTER .

or more easy  :   dumpShx.exe   -o  c:\t\2.shp    c:\t\1.shx   or   :   dumpShx.exe   -o  d:\2.shp    d:\1.shx    and press ENTER .

5. Enjoy !

 

Picture attached .

 

DumpShx.jpg

  • Like 1
Link to comment
Share on other sites

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