Subscribe to this thread
Home - General / All posts - Array
jjensen5 post(s)
#12-Feb-18 20:16

In auto cad you can copy a line in an array with certain number of segments and spacing. Do they call it an array? How is this done in manifold? I searched for it in the index.


7,778 post(s)
#12-Feb-18 22:25

Can you give a link to the AutoCAD function specification, or to a Help file?

At first glance, it seems that this task would require custom SQL.

There are analogous built-in functions, but not an exact match.

(If you later need help with SQL, the normal thing is to post sample data, with a question tightly focussed on that data.)


1,837 post(s)
#12-Feb-18 23:15

This thread has just what is needed by Tim (tjhb). Very useful.

Aussie Nature Shots

jjensen5 post(s)
#13-Feb-18 15:04

I want to make 10 copies of a line, move it 90 degrees, and 150 units. The name of my drawing is "Drawing". I selected the object in my drawing and then I executed or run the query.

I Pasted this into a query and I get (unexpected token ' ' at line 1).


INSERT INTO [Drawing] ([Geom (I)])

SELECT MoveVertically(MoveHorizontally([ID], [N] * [dX]), [N] * [dY])


[Drawing] AS [D]


(SELECT [Digit 4] * 1000 + [Digit 3] * 100 + [Digit 2] * 10

+ [Digit 1] + 1 AS [N]


(VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9) NAMES ([Digit 4]))


(VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9) NAMES ([Digit 3]))


(VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9) NAMES ([Digit 2]))


(VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9) NAMES ([Digit 1])))

ON [D].[Selection (I)]

AND [N] <= [Copies]


(VALUES ([Offset] * Sin(Deg2Rad([Direction])),

[Offset] * Cos(Deg2Rad([Direction])))

NAMES ([dX], [dY]));

What am I missing or doing wrong?


7,643 post(s)
#13-Feb-18 15:46

I am not sure why you are having parameters named '10', '90', '150', they don't appear to be used. (Maybe it's 'Offset', 'Direction' and 'Copies' that should be parameters? Then the first line should be: PARAMETERS [Copies] SINGLE, [Direction] DOUBLE, [Offset] DOUBLE; and the values you will supply in a dialog.)

Could you post a reduced version of your MAP file with just the components used by the query (and the drawing perhaps reduced to a couple of objects)?

jjensen5 post(s)
#13-Feb-18 16:00

What brings up the dialog box so I can enter the values? I run the script like the original and it gives me a "Token expected". I don't know how to reduce a map file?

jjensen5 post(s)
#13-Feb-18 16:04

This is my map called "test"



7,643 post(s)
#13-Feb-18 16:22

Thanks for the file.

It's the whitespace. The spaces are 0xA0 (non-breaking space) instead of 0x20 (regular ASCII space), so they render the same but choke the query parser. This is likely the result of copy/pasting from a browser.

The solution is to replace all such spaces manually. Replace spaces in the first few lines, try running the query, see where the error now is, go to that line, replace spaces there, etc. (Yes, I agree that maybe we should have had a function in 8 to replace all weird Unicode whitespace with ASCII whitespace. This is not a problem in 9, it just accepts Unicode whitespace as whitespace.)

jjensen5 post(s)
#13-Feb-18 18:28

Thank You!

That resolved my problem.

Works great.

Manifold User Community Use Agreement Copyright (C) 2007-2017 Manifold Software Limited. All rights reserved.