News:

Interested in some really terrific mobile apps? Visit www.turboapps.com for details.

Main Menu
TurboCAD 2026 Platinum box
Now available

TurboCAD 2026.2

The latest update for TurboCAD 2026. It installs over any 2026 build and keeps your activation, drawings and settings. Get it from the Start Page or Help > Check for Update.

SVG of hidden lines + perspective view

Started by chuckmcm, July 18, 2022, 02:52:47 PM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

chuckmcm

Hi All,

For the first time I thought "Oh yeah, I can save things as SVG!" when thinking about creating a web page asset out of a model.

I set up my model, positioned the camera, set it for hidden line and perspective, and have a nice line drawing of the ortho projection of my model. I select it, save as SVG (selected only) and save it. There does not appear to be any options for SVG in the save dialog.

When I open it in a browser (any browser) it shows up positioned and viewed correctly, but wireframe, not hidden line. (so the camera view is correct, even the perspective, but the rendering mode is not.

Back in the "old" days I did this once by creating an image then firing up Corel Trace and having it convert the image to vectors, but given TC *knows* how to draw it as I want it, not sure which bit to set to have it pick up the correct rendering mode.

--Chuck
TC Plat Pro 2021, Win 10, Surface Book, first TurboCAD version 3.0 (still have the disks!)

murray dickinson

I haven't done it in a while, but I think I remember successfully saving .svg as hidden line from viewport in paperspace, alternatively from hidden line vector view in drafting palette, although no perspective from that option.  Recent versions' "flat shot" will probably do what you're wanting too.

Jeff_in_90620

Do you want a 3D object that can be rotated in a web browser's window?

If so, consider saving as a 3D PDF.

It not, investigate the Flat Shot command.


Jeff
Jeff

TC 2026 Pro Platinum plus 2015->2024 (most with LightWorks & RedSDK) & V21
System: AMD Ryzen 9 7950X, MSI Mag X670E Tomahawk WiFi, 64GB RAM @ 4.80GHz, ARC A770 w/16GB, 3 x Samsung NVMe 990 (1TB), Windows 11 Pro (64-bit)

chuckmcm

Okay then, thanks @jeffin90620, that lead got me somewhat there. I did the flat shot and then inserted the block it created into paper space, then selected that block, and then saved as SVG (selected only) and the resulting SVG is nearly correct.

What isn't correct is that I just randomly dropped it into paper space and it created an SVG of the whole paper (the offsets for the model are wrong, not zero based (top, left) but down where I dropped it. Will play around with this command some more to see if I can beat it into submission.

Thanks again.
TC Plat Pro 2021, Win 10, Surface Book, first TurboCAD version 3.0 (still have the disks!)

Jeff_in_90620

Quote from: chuckmcm on July 19, 2022, 10:23:30 PMI did the flat shot and then inserted the block it created into paper space

Why not put it in Model space and save from there?  You can either put it on its own layer or select it and make sure the Selection option in the file manager popup is selected.


Jeff
Jeff

TC 2026 Pro Platinum plus 2015->2024 (most with LightWorks & RedSDK) & V21
System: AMD Ryzen 9 7950X, MSI Mag X670E Tomahawk WiFi, 64GB RAM @ 4.80GHz, ARC A770 w/16GB, 3 x Samsung NVMe 990 (1TB), Windows 11 Pro (64-bit)

chuckmcm

Quote from: Jeffin90620 on July 19, 2022, 11:36:46 PMWhy not put it in Model space and save from there?  You can either put it on its own layer or select it and make sure the Selection option in the file manager popup is selected.

Hmm, just to be clear, I have always insured that 'Selection' was checked. That doesn't change the behavior.

What is more interesting is that Flat Shot makes a block but I cannot put that block in model space. Trying to drag it into model space from the blocks pallet gives me the "can not do" cursor. I'd send ya screen shots but since that doesn't work well, can't do that.

I've confirmed the workplane is where it should be, but the Insert=>Blocks menu item opens the blocks palette but as I have mentioned there isn't any way to get it into model space. In paper space it drags and drops just fine. And it has a nice bounding box as one would expect, but save-as from paper space with the block selected saves it inside a while rectangle the size of the page.

Another tidbit, if you have multiple blocks on the page, and select one, and File->SaveAs, and pick selected you only get the one you selected, but it is still ensconced in a page sized white rectangle.

So while this sounds like someone one should be able to do (I'm on 2021 Pro Plat) in my case it is not obvious how one would make that happen. If I may be so bold, try these three steps and tell me what you get:

  • Open a new drawing and insert a 3D solid (box works well)
  • Move the camera to ortho, select your box and use Modify=>Modify 3d Objects=>Flat Shot ... to create Block_0 (on the Flat Shot dialog uncheck block out of a hidden line view
  • Insert that block into model space (somehow?)

Tell me exactly what steps you took to make #3 work. That would be really helpful.

On a whim I tried setting the paperspace page layout to be 3" x 5" (index card) to see if it would be a smaller rectangle but no, same.

I would kind of be okay if it scaled out the drawing to fit inside a 1024 x 768 co-ordinate space and then I could have the browser re-size it to something else, alas it doesn't do that either. I may be able to import it into inkscape and fix it, or I might just have to write a program that reads in the file and returns just the object and fixes the box issue.

--Chuck

TC Plat Pro 2021, Win 10, Surface Book, first TurboCAD version 3.0 (still have the disks!)

Torfinn

You insert the block in Modelspace and make a view of it, and then insert a viewport of it in Paperspace

Torfinn
V20, V21, 2015 > 2024  Platinum
Deluxe 2015/ 16/ 19
RedSDK enabled
Windows 10 Home Premium (20H2/ 19042.1083) 64 bit, 32 GB
NVIDIA Geforce GTX 780m, 1 GB

Andy H

#7
Quote from: chuckmcm on July 20, 2022, 08:25:36 PMWhat is more interesting is that Flat Shot makes a block but I cannot put that block in model space. Trying to drag it into model space from the blocks pallet gives me the "can not do" cursor. I'd send ya screen shots but since that doesn't work well, can't do that.

Just one thought.  When inserting into model space.  Did you make sure you were in wireframe.  As block won't insert if you are in hidden line mode.  (and ensured that layer '0' was turned on).

I just tried in 2021 plat, and it inserted fine fine into wireframe model space.

Jeff_in_90620

Quote from: chuckmcm on July 20, 2022, 08:25:36 PMWhat is more interesting is that Flat Shot makes a block but I cannot put that block in model space. Trying to drag it into model space from the blocks pallet gives me the "can not do" cursor.

I verified I could do that before I suggested it.

Now, I am suggesting that you delete the flat shot block and, in Wireframe mode, copy all and paste into a new drawing, save it, close TurboCAD, re-start it and open the new file.  From there, create a new Flat Shot and drag that into Model space.


Jeff
Jeff

TC 2026 Pro Platinum plus 2015->2024 (most with LightWorks & RedSDK) & V21
System: AMD Ryzen 9 7950X, MSI Mag X670E Tomahawk WiFi, 64GB RAM @ 4.80GHz, ARC A770 w/16GB, 3 x Samsung NVMe 990 (1TB), Windows 11 Pro (64-bit)

Torfinn

#9
Most likely you are in HL render mode when try to insert the Flatshot Block, like Andy and Jeff both mention.
You need to make it to a hidden line block, not to be in Hidden line render mode, and you can insert it in P space also

Torfinn

https://drive.google.com/file/d/1L3xUkbDGPPq3ppxRevOS6qb9MCyE_G-P/view?usp=sharing

This link work,
V20, V21, 2015 > 2024  Platinum
Deluxe 2015/ 16/ 19
RedSDK enabled
Windows 10 Home Premium (20H2/ 19042.1083) 64 bit, 32 GB
NVIDIA Geforce GTX 780m, 1 GB

Jeff_in_90620

Jeff

TC 2026 Pro Platinum plus 2015->2024 (most with LightWorks & RedSDK) & V21
System: AMD Ryzen 9 7950X, MSI Mag X670E Tomahawk WiFi, 64GB RAM @ 4.80GHz, ARC A770 w/16GB, 3 x Samsung NVMe 990 (1TB), Windows 11 Pro (64-bit)

Torfinn

Quote from: Jeffin90620 on July 21, 2022, 03:00:04 AM
Quote from: Torfinn on July 21, 2022, 01:33:40 AMhttps://drive.google.com/file/d/1WFzTzGHOC--TUqQaACja0lcfrNPxHGsj/view?usp=sharing

This file/folder needs permission.  You might have already seen my request.


Jeff


Sorry Jeff i was away from pc, so did not see it before now, but link is changed so now it should work.

Torfinn
V20, V21, 2015 > 2024  Platinum
Deluxe 2015/ 16/ 19
RedSDK enabled
Windows 10 Home Premium (20H2/ 19042.1083) 64 bit, 32 GB
NVIDIA Geforce GTX 780m, 1 GB

chuckmcm

Quote from: Torfinn on July 21, 2022, 01:33:40 AMMost likely you are in HL render mode when try to insert the Flatshot Block, like Andy and Jeff both mention.
You need to make it to a hidden line block, not to be in Hidden line render mode, and you can insert it in P space also

Interesting, I was in "hidden line" render vs "wireframe" render, and it is true that in wireframe render mode you can insert blocks into model space. (Not sure I understand the logic, but that combination allows for insertion)

The main problem however is that exporting the block as an SVG doesn't use the block extents for the SVG viewbox/co-ordinates it creates a 1024 x 768 viewbox and then sticks it in there.

Playing around if I scale it in the drawing, and then export it, it shows up in the box scaled.

I created a web page and stuck it on my web server here: http://mcmanis.com/tcad-svg-export.htm and you can see the effect I'm talking about.

What I want, is to be able to export a perspective correct line drawing of a model with hidden lines removed as a vector asset for my web pages. This lets it display well on high dpi and low dpi devices and is generally much nicer now that everyone supports SVG in the browser. I would like the 'viewbox' for it to be the extents of the lines in the export.

Apparently, if I look at the extents on the inspector, there will be a scaling number that will cause the model to precisely fill the viewbox that the SVG exporter uses. It is a simple affine scaling transform in the X and Y dimensions from model space to 'svg viewbox' space. At that point I can use the browser to make it what ever size I want because it has that transform "built in" for images and will do the scaling on vectors just as easily.

So getting closer to what I want, I still thing TCAD is broken with respect to SVG export, and now I need to figure out if I can reliably produce the figures I want. It is an interesting trip.

--Chuck
TC Plat Pro 2021, Win 10, Surface Book, first TurboCAD version 3.0 (still have the disks!)

Jeff_in_90620

Quote from: Torfinn on July 21, 2022, 06:31:19 AMSorry Jeff i was away from pc, so did not see it before now, but link is changed so now it should work.

Nope.  Tried with two different browsers and two different Google Drive sign-in accounts.


Jeff
Jeff

TC 2026 Pro Platinum plus 2015->2024 (most with LightWorks & RedSDK) & V21
System: AMD Ryzen 9 7950X, MSI Mag X670E Tomahawk WiFi, 64GB RAM @ 4.80GHz, ARC A770 w/16GB, 3 x Samsung NVMe 990 (1TB), Windows 11 Pro (64-bit)

Torfinn

Then i don't know, as if i click on that link it will open Google drive and show the picture
But will send it in your mail, it's just flatshot in P space and M space of a ppm

Torfinn
V20, V21, 2015 > 2024  Platinum
Deluxe 2015/ 16/ 19
RedSDK enabled
Windows 10 Home Premium (20H2/ 19042.1083) 64 bit, 32 GB
NVIDIA Geforce GTX 780m, 1 GB

Alvin Gregorio

Quote from: Torfinn on July 21, 2022, 04:45:12 PMThen i don't know, as if i click on that link it will open Google drive and show the picture
But will send it in your mail, it's just flatshot in P space and M space of a ppm

Torfinn
As the Owner/Publisher, you have the Permission, Torfinn.
Did you choose the Sharing option "Anyone with the Link can View (or Edit)", or similar.

HERE is what I see when I click on your Link Torfinn.  (I set my Google Drive Share permission for this as "Anyone with Link-- Viewing".
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

Andy H

#16
Quote from: chuckmcm on July 21, 2022, 02:15:27 PMSo getting closer to what I want, I still thing TCAD is broken with respect to SVG export, and now I need to figure out if I can reliably produce the figures I want. It is an interesting trip.


As a last resort, use a third party program.  I prefer Inkscape for svg, but Affinity designer, Corel Draw, and many others will do the job.  NOTE.  I only tested Inkscape (v1.0), Affinity, and Corel. I don't have Adobe illustrator etc.

With Inkscape. 
Save-as, selection ticked - a selected exploded flat shot model space block
Open in inkscape. Drag a selection windows around the objects.
Adjust stroke style (line width) to suit.
Edit menu - Resize page to selection.
Save or Save-as - 

Torfinn

And i believed i did that also, but made a new copy of picture and new link now, just in case, hopefully it will work.
The link symbol is green, so it should work

https://drive.google.com/file/d/1g9QYlXe3-MvhqkbL7Q_Xo212HOutxm_7/view?usp=sharing

Torfinn
V20, V21, 2015 > 2024  Platinum
Deluxe 2015/ 16/ 19
RedSDK enabled
Windows 10 Home Premium (20H2/ 19042.1083) 64 bit, 32 GB
NVIDIA Geforce GTX 780m, 1 GB

Alvin Gregorio

Quote from: Torfinn on July 21, 2022, 05:34:39 PMAnd i believed i did that also, but made a new copy of picture and new link now, just in case, hopefully it will work.
The link symbol is green, so it should work

https://drive.google.com/file/d/1g9QYlXe3-MvhqkbL7Q_Xo212HOutxm_7/view?usp=sharing

Torfinn

That works
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

Jeff_in_90620

Quote from: Torfinn on July 21, 2022, 05:34:39 PMmade a new copy of picture and new link now, just in case, hopefully it will work

It worked this time.


Jeff
Jeff

TC 2026 Pro Platinum plus 2015->2024 (most with LightWorks & RedSDK) & V21
System: AMD Ryzen 9 7950X, MSI Mag X670E Tomahawk WiFi, 64GB RAM @ 4.80GHz, ARC A770 w/16GB, 3 x Samsung NVMe 990 (1TB), Windows 11 Pro (64-bit)

Torfinn

Horray  :)

I'm glad it finally worked now.

Torfinn
V20, V21, 2015 > 2024  Platinum
Deluxe 2015/ 16/ 19
RedSDK enabled
Windows 10 Home Premium (20H2/ 19042.1083) 64 bit, 32 GB
NVIDIA Geforce GTX 780m, 1 GB

chuckmcm

It did work Torfinn! I sent you an email in response with a screen shot as well.

Thanks to earlier being pointed at "Flat Shot ..." I reached that point, and with the "magic" that you have to be in wireframe mode to get it into model space I can look at it in model space or paper space.

The last problem is that when it is exported as an SVG it is in an a giant "viewbox" (this is an SVG term) and so trying to put in a web page either fills the page with whitespace, or if I scale the svg file, makes a tiny little picture surrounded by white pixels.

--Chuck
TC Plat Pro 2021, Win 10, Surface Book, first TurboCAD version 3.0 (still have the disks!)

Torfinn

Quote from: chuckmcm on July 21, 2022, 08:31:38 PMIt did work Torfinn! I sent you an email in response with a screen shot as well.

Thanks to earlier being pointed at "Flat Shot ..." I reached that point, and with the "magic" that you have to be in wireframe mode to get it into model space I can look at it in model space or paper space.

The last problem is that when it is exported as an SVG it is in an a giant "viewbox" (this is an SVG term) and so trying to put in a web page either fills the page with whitespace, or if I scale the svg file, makes a tiny little picture surrounded by white pixels.

--Chuck

Good you worked it out :)
The reason for why you get a large white "empty" svg file when you open it in a browser is that the line's are to thin.
Attached link will show picture of a box in HL/HL render on right side, and exploded on left side (9 lines), and lines are set to 1 mm in TC
TC 2021 will not be able to open a svg file.
You can play with the drawing by File/ Publish to pdf, and insert that pdf as Underlay in TC again, explode that pdf 1 time and you have a crisp vector

https://drive.google.com/file/d/1CrWepGbQBlHaWNjlkno5PapV_R8zt0Ai/view?usp=sharing

Torfinn
V20, V21, 2015 > 2024  Platinum
Deluxe 2015/ 16/ 19
RedSDK enabled
Windows 10 Home Premium (20H2/ 19042.1083) 64 bit, 32 GB
NVIDIA Geforce GTX 780m, 1 GB