Unit Of Measure Used In jszpl - node.js

I use jszpl to generate .zpl within my Nodejs application. Many elements have properties referencing a size, but I can't find anywhere what the unit of measure is. I thought the unit of measure was millimeters, but I was finding that is not the case based on my testing.
For example:
const text1 = new Text();<br/>
label.content.push(text1);<br/>
text1.fontFamily = new FontFamily(FontFamilyName.F);<br/>
text1.horizontalAlignment = new Alignment(AlignmentValue.Center);<br/>
**text1.top = 44;**<br/>
text1.text = 'Roll ID';
I thought in this example I was setting the text to generate 44mm from the top of the parent, but that is not the case.
Does anyone know what unit of measure is being used?

The standard unit of measurement in ZPL is dot. It is also mentioned in JSZPL github that the measurement unit used in the library is dot. Now, what is dot?
Dot is a variable size unit, its size depends on dpi (dots per inch) setting of the printer. It can have values 152, 203, 300, 600, although not all printers support all of them. Usually supported values are 203 and 300 dpi. You can set this directly on the printer via buttons, via web GUI (if you are using network connection), Zebra setup utilities or by using the ^MU ZPL command.
So, the size of a dot is determined by dpi setting. Lets say that your printer is set up to 203 dpi and you are using value 44 in your code. As the name suggests, 203 dpi means 203 dots per inch, so the real world length is 44/203 inch. To convert it to milimeters it would be (44/203)*25,4 mm. In case of 300 dpi just swap the 203 value with 300.
More about ZPL basics in ZPL manual or in Labelary introduction to ZPL.
You can also try Labelary Online ZPL viewer where you can change dpi settings and experiment on what does it do to your code.

Related

How to remove a feature from a product?

So I am still learning this amazing complex system folks call Hybris, or SAP Commerce, along with lots of other names :) I ran into a problem and am looking to learn how to get out of it. I have added four new classifications attributes (Utilization, Fit, Material, Function). When I went to add them to the products I added a space between them and the numeric code that came after it:
$feature1=#Utilization, 445 [$clAttrModifiers]; # Style
$feature2=#Fit, 446 [$clAttrModifiers]; # Colour
$feature3=#Material, 447 [$clAttrModifiers]; # Connections
$feature4=#Function, 448 [$clAttrModifiers]; # Function
INSERT_UPDATE Product;code[unique=true];$feature1;$feature2;$feature3;$feature4;$catalogVersion;
;300413166;my;feature;has;a space
The problem is I want to take the space out, as seen in the follow code:
$feature1=#Utilization,445 [$clAttrModifiers];# Style
$feature2=#Fit,446 [$clAttrModifiers];# Colour
$feature3=#Material,447 [$clAttrModifiers];# Connections
$feature4=#Function,448 [$clAttrModifiers];# Function
INSERT_UPDATE Product;code[unique=true];$feature1;$feature2;$feature3;$feature4;$catalogVersion;
;300413166;Bottom;Loose;Yam type;Sportswear
When I run both of these scripts together, I get 8 features:
So how do I remove the four features that have spaces in them?
How do I go about actually removing the first set of features?
Below removes the ClassAttributeAssignment records, which also removes the ProductFeature entries assigned to all products. However, you need to find the correct classification category code (e.g. clasificationCategory1) the attribute (e.g. Utilization, 445) belongs to. The classification category is the grouping/header you will find in the Attributes
$classificationCatalog=ElectronicsClassification
$classificationSystemVersion=systemVersion(catalog(id[default=$classificationCatalog]),version[default='1.0'])[unique=true,default=$classificationCatalog:1.0]
$classificationCatalogVersion=catalogversion(catalog(id[default=$classificationCatalog]),version[default='1.0'])[unique=true]
$class=classificationClass(code,$classificationCatalogVersion)[unique=true]
$attribute=classificationAttribute(code,$classificationSystemVersion)[unique=true]
REMOVE ClassAttributeAssignment[batchmode=true];$class;$attribute
;clasificationCategory1;Utilization, 445
;clasificationCategory1;Fit, 446
You can also remove the ProductFeature entries (for all products) like this, but it doesn't remove the ClassAttribute assignment.
REMOVE ProductFeature[batchmode=true];qualifier[unique=true]
;ElectronicsClassification/1.0/clasificationCategory1.Utilization, 445
Other Reference:
Classification System API: https://help.sap.com/viewer/d0224eca81e249cb821f2cdf45a82ace/1905/en-US/8b7ad17c86691014aa0ee2d228c56dd1.html

Specify the specific heat of a material with Revit 2017 Python API

With Revit 2017 Python API, I am trying to create new materials, and then assembling some of these to create new type of walls.
It goes pretty well for all properties, except for the specific heat!
Basically, what I do is:
create a thermalAsset:
themalA = ThermalAsset('Test', ThermalMaterialType.Solid)
Set the different thermal properties for that thermal asset (dummy values):
thermalA.ThermalConductivity = 0.01
thermalA.SpecificHeat = 0.001
thermalA.Density = 1000.0
Then I create a PropertySetElement with that thermal asset:
pse = PropertySetElement.Create(doc, thermalA)
Then I assign it to my material (that I previously created):
mat.SetMaterialAspectByPropertySet(MaterialAspect.Thermal, pse)
Afetr that, I take a look in my materials list in Revit, and look at the thermal properties. Everything seems ok, except the Specific Heat, which remains at 0.0239 btu/(lb. F), whatever the value I input when I assign the specific heat. Density is ok, thermal conductivity is ok, but not specific heat.
I got no error message.
What am I missing?
Thanks a lot for any help.
Arnaud.
Is the value you specify in the expected unit? Feet per Kelvin, squared-second. Cf., http://thebuildingcoder.typepad.com/blog/2013/04/whats-new-in-the-revit-2014-api.html > ThermalAsset.SpecificHeat.
I submitted this to the development team for further analysis as issue REVIT-111206 [API: setting ThermalAsset SpecificHeat fails]. Can you please provide a full reproducible case for them to test, e.g., a minimal RVT model with an embedded macro to run, cf., http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b? Thank you!

How do I use the link for a Foursquare photo?

I am trying to use the foursqaure API via the HTTP requests.
So I send a http request looking similar to this ->
https://api.foursquare.com/v2/venues/explore?ll=40.7,-74&venuePhoto=1&oauth_token=(OAUTH_TOKEN)&v=20151015
I get one massive JSON object with a bunch of data and inside the data I find the photos Prefix and suffix.
My problem is when I try and use the &venuePhoto=1.
I get a prefix and suffix for what seems to be 1 picture in the following form.
prefix: "https://irs1.4sqi.net/img/general/"
suffix: "/63892328_N0A_9qgk0N30lHiqDWIRtNb-0YfO84BIxHc9SP7h4rY.jpg"
I can not seem to get this string to get me the picture.
If I put them together even without one of the "/" slashes it still does not give me a picture.I have already tried a whole bunch of things.
I thought adding this option to the request URL I can void using the photo part of the api and get everything in 1 go.
AM I missing something? Should I be using some other part of the API to get the pictures.?
You need to specify the size of image.
prefix + "100x100" + suffix
e.g. https://irs1.4sqi.net/img/general/100x100/63892328_N0A_9qgk0N30lHiqDWIRtNb-0YfO84BIxHc9SP7h4rY.jpg
See also Foursquare API document
To assemble a resolvable photo URL, take prefix + size + suffix, e.g. https://irs0.4sqi.net/img/general/300x500/2341723_vt1Kr-SfmRmdge-M7b4KNgX2_PHElyVbYL65pMnxEQw.jpg.
size can be one of the following, where XX or YY is one of 36, 100, 300, or 500.
XXxYY
original: the original photo's size
capXX: cap the photo with a width or height of XX (whichever is larger). Scales the other, - smaller dimension proportionally
widthXX: forces the width to be XX and scales the height proportionally
heightYY: forces the height to be YY and scales the width proportionally

7" tablet is taking 10" layout

I have a problem with device picking wrong layout.
I have defined my layouts as per the screen size and grouped them under following -
layout-sw600dp, layout-sw720dp and layout-sw480dp.
I have two 7" tablets for sw600dp.
1- Samsung 7" galaxy tab - This device is taking correct layout as those defined in layout-sw600dp.
2- Another 7" device [ordered from a distributor in China]- This one is taking 10" layout.
When I use http://www.whatismyscreenresolution.com/ both the devices give 1024x600 .
To check I programmatically retrieved Smallest Screen Width and Screen Width [getResources().getConfiguration().smallestScreenWidthDp and screenWidthDp]. On 2nd device I get values as 720 and 1024.
Any idea as how can I proceed further to make sure that my second device also takes layouts defined under layout-sw600dp .
regards
Pradeep
what does this code returns on that device ?
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
String pxSize = dm.widthPixels + " x " + dm.heightPixels;
it may show 720x1024.
that's because even if the screen has a physic size of 600x1024px, what you get from those methods are values set by manufacturers. There is possibly a difference between those set values and real values.
If this is the case, there no much you can do about it.
except may be
if ( "aTargetManufacturer".equals( android.os.Build.MANUFACTURER ) )
{
useAnotherLayout();
}
but that's clearly not good practice.

How to get moving object's mask using OpenCV BackgroundSubtractorMOG2

I want to mask the moving objects from video.
I found that OpenCV has some built-in BackgroundSubtractors which could possibly saving my time a lot. However, according to the official reference, the function:
void BackgroundSubtractorMOG2::operator()(InputArray image, OutputArray fgmask, double learningRate=-1)
should output a mask, fgmask, but it doesn't. The fgmask variable will contain the "contour of the mask" instead after invoking above method. That's weird. All I want is a simple closed region filled with white color(for example) to represent the moving objects. How could I do that?
Any reply or recommendation would be very appreciate. Thanks a lot.
Here's my code:
int main(int argc, char *argv[])
{
cv::BackgroundSubtractorMOG2 bg = BackgroundSubtractorMOG2(30,16.0,false);
cv::VideoCapture cap(0);
cv::Mat frame, mask, _frame, _fmask;
cvNamedWindow("mask", CV_WINDOW_AUTOSIZE);
for(;;)
{
cap >> frame;
bg(frame,fmask,-1);
_frame = IplImage(frame);
_fmask = IplImage(fmask);
cvShowImage("mask", &_fmask);
if(cv::waitKey(30) >= 0) break;
}
return 0;
}
A snapshot of the output video is:
p.s. My working environment is OpenCV2.4.3 on OSX 10.8 and XCode 4.5.2 with apple LLVM compiler 4.1.
If you want to acquire the whole objects filled with white pixels in the foreground then I would ask you to tell me something about your experience.
My question is, for the code, you mentioned above, do you get more white pixels when you generate more motion in front of your camera?
If yes then there are two paramenters to learn about for your requirement.
First is the History parameter. which you have configured as 30 in the constructor BackgroundSubtractorMOG2(30,16.0,false);. You can test this param by incresing, say to 300. It will maintain the motion history of the object in the foreground. So if you have moved completely from your starting location within the 300 frames then you will get whole object covered with white pixels as you want. but it will be erased gradually. So it cannot give you the 100% solution.
The second parameter is called learning rate. In the code you mentioned bg(frame,fmask,-1); where -1 is your learning rate. you can set it to 0.0 to 1.0 and default is -1. When you set it 0, you will get what you want for the objects which are not part of the frame in the starting of the video. You can call this kind of object "foreign objects". You will get foreign object covered with white pixels.
Explore your testing from the information I have mentioned above and share your experience.

Resources